The blog of Jafar Aliyev


Creation date:

Default values

JVM gives the defalut values to instance variables but not to stack (method) variables. Only arrays are exception from this rule. If you initialize the array like int[] intArr = new int[10]; java gives zero (default value for int) to all elements of array and it does not depend whether intArr is local or method variable. Another example is Object[] objArray = new Object[10]; Inthis case all elements of array will be null.

Author: Jafar N.Aliyev (Jsoft)

Read also

Use instanceof carefully
Usage of 'instanceof' method in some situations will give you a compilation error

Java access and nonaccess modifiers
Look at this cheat sheet for Java access and nonaccess modifiers

Static methods can not be overriden
Here I explain, why static methods can not be overriden

© Copyright

All articles in this site are written by Jafar N.Aliyev. Reproducing of any article must be followed by the author name and link to the site of origin(this site). This site also keeps the same rules relative to the articles of other authors.