🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
  1. A.GST_RATE becomes 0.12
  2. B.It runs but prints a warning
  3. C.GST_RATE becomes 0.30
  4. 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 →