Wednesday, 11 September 2013

Java literals, really constants?

Java literals, really constants?

I see/hear people talking about literals as constants, but are they really
constants?
I think of final as a constant:
final constantNumber = 10;
E.g. in the literal below, I am able to change the value.
int testNumber = 10;
System.out.println(testNumber);
testNumber = 20;
System.out.println(testNumber);

No comments:

Post a Comment