Accenture Java Programming Practice Question
Given: public class ItemTest { private final int id; public ItemTest(int id) { this.id = id; } public void updateId(int newId) { id = newId; } public static void main(String[] args) { ItemTest fa = new ItemTest(42); fa.updateId(69); System.out.println(fa.id); } } What is the result?Answer options
A
updateId(69); System.out.println(f
B
id); } } What is the result?
C
CompileTime Error
D
69
E
Runtime Error
Correct answer: CompileTime Error
Explanation
Correct answer: CompileTime Error.