class constants instance constants..... etc
i need some brief explanation about these types of data values.... just a little bit of understandable explanation about these...
for example
private static final int FIRST_NUMBER = 1; //this is a class constant
but the book that i've red says that if THIS constant variable declared as..
like this..
private final int FIRST_NUMBER = 1; //then this is an instance constant
every instances of the class will have the same value
i dont get this point...
just a little bit of understandalbe explanation.
Re: class constants instance constants..... etc
These two lines have one difference and that is the static keyword.
A static variable exists only once per class, if the variable was not final you could change it in one reference of the class and it would change in the other class as well.
See What does the 'static' keyword do in Java? - Stack Overflow
// Json