Question 2
Back to Exercise
The program below does not compile. Which statement correctly describes the problem?
public class Main {
public static void main(String[] args) {
final double rate = 7.5;
rate = 8.0;
System.out.println(rate);
}
}
- A double cannot be final
- B rate is final and already assigned, so it cannot be assigned again Correct
- C final variables must be static
- D 8.0 must be 8.0f
Correct Answer: Option B
Remove final if the value really needs to change.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!