Originally posted by Veena Point:
When the instance variables are initialized?During compile time or during runtime?
Variables are never initialized at compile time. The compiler only generates byte codes. It doesn't create variables. That's a job for the JVM at runtime.
A better question would be, "Are instance variables initialized at class load time or at class instantiation time?"
In that case, instance variables are initialized at class instantiation time - you need an instance to have an instance member. Static members, however, are initialized at class load time.
I hope that helps,
Corey