Sathi Krishna wrote:As per I know,
while compiling the variable "tablesCount" is created but value is not assigned.
If it is static variable the value will also be assigned during compile time.
So in our case, no chance for compile time error.
variable got created in memory and assigned with zero value.
Just try with commenting the below statement in your program
If you have a debugger availiable maybe in Eclipse just run the debugger with a watch on the static variables or a breakpoint before you create a new instance of the class. You will see that upon loading an instance from the main method the variables have value = 0 before any code is stepped through. Sathi has it spot on