← Quiz: Java Data Types: all 10 questions
Quiz: Java Data Types · Question 10 of 10
What happens with this code? (code)
What happens with this code?
final double GST_RATE = 0.18;
GST_RATE = 0.12;
- A.GST_RATE becomes 0.12
- B.It runs but prints a warning
- C.GST_RATE becomes 0.30
- D.Compile error: a final variable cannot be assigned again
Answer & explanation
Correct answer: Compile error: a final variable cannot be assigned again
final means the value can be set only once.
Can you get the rest right without peeking?
Take the timed Quiz: Java Data Types quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →