Parameter Independence
Consider a program that passes an integer to a method intended to modify it.
What is printed when the following Java program is compiled and run?
public class QuestionTrace {
public static void main(String[] args) {
int score = 10;
update(score);
System.out.print(score);
}
public static void update(int score) {
score = score + 50;
}
}
A
60
B
50
C
10
D
0
Question Leaderboard
Not enough data yet to show leaderboard.
