🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: static, final and Nested Classes: all 10 questions

Quiz: static, final and Nested Classes · Question 4 of 10

Which statement about a blank final field is correct?

Which statement about a blank final field is correct?

  1. A.It can be changed in any method
  2. B.It must be assigned exactly once, in every constructor (or at declaration)
  3. C.It is automatically set to 0 and can never be assigned
  4. D.It must also be static
Answer & explanation

Correct answer: It must be assigned exactly once, in every constructor (or at declaration)

A final field without a value must be given one exactly once during construction.

Can you get the rest right without peeking?

Take the timed Quiz: static, final and Nested Classes quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →