Originally posted by kalpana Kumar:
final int a=1;
final int b;
b=20;//is this b not final
Both a and b are final, but a is declared with an initializer
that is a constant expression. b is declared as
blank final.
Originally posted by kalpana Kumar:
But in the above code b is defined to be final. it is initialised in the next line.
I wanted to know if there is any difference in this type of initialization.
Yes there is. Here are two pointers into the JLS you can
take a look at:
constant expressions (see the last two items in the bulleted list)
definite assignment of blank finals
[ November 06, 2005: Message edited by: Brian Cole ]