Originally posted by Michael Raymond Jr.: i think virkant's way referring to instance variables, where 0 is assigned implicitly. your x variable is not an instance so has no value and therefore can be reasigned a new value once.
I still don't think I agree. Try this program that compiles and runs:
[edit: Ok, it doesn't run because it has no main(), but you know what I mean. Btw, you can check out blank finals in the JLS.] [ September 20, 2007: Message edited by: Brian Cole ]
Originally posted by Jan Nowak: Final instance variables must be initialized before constructor completes - so K&B book says. Brian's code is changing final value in a constructor. Try doing it in an instance method.
oh god, how did i miss that!!! ;-)))
didn't even see the name of the method was the same as the class in code.
Scooby Snacks for everyone...<br /> <br />SCJA, SCJP 1.4
Straws are for suckers. Now suck on this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop