public static final int SIZE = 40;
unfortunately, this will then only be available as SIZE within the class it is declared. If you want to use it in other classes, you'll need to qualify it with the class name that it was declared in
for example assume this:
Code:
public class Foo
{
public static final int SIZE = 40;
public void doSomething()
{
//Here we can refer to the constant as just 'SIZE'
System.out.println( "The value of size is: " + SIZE );
}
}
but when we are in another class it works like this:
Code:
public class Bar
{
public void doSomethingElse()
{
//Here we must qualify the constant with the name of the class
// that it was declared in.
System.out.println( "The value of size is: " + Foo.SIZE );
}
}
Note that this is not a compiler thing. If I had it within a String literal, it wouldn't change to 40.
Hope this helps,
Domi_fan