How static variable work in java?



How static variable work in java?..

Answer / Mithun Singh Rana

"Static variables are class variables, not instance variables. They are shared among all instances of the class and each instance does not have its own copy of a static variable. Static variables are initialized only once when the class is loaded by JVM. Their values are accessed directly through the reference to the class rather than an object of that class."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are the different types of inner classes?

1 Answers  


Difference between start() and run() method of thread class?

1 Answers  


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

1 Answers   Ciena,


What is the flag in java?

1 Answers  


What will be the initial value of an object reference which is defined as an instance variable?

1 Answers  


Is it possible to declare abstract class as final?What happens if we do so?

1 Answers  


What’s the difference between the methods sleep() and wait()?

1 Answers  


What is an example of a constant variable?

1 Answers  


posted in online test

1 Answers  


What is difference between array and arraylist in java?

1 Answers  


what do you meant by Runtime Polymorphism?

13 Answers   BVIMR, IBM, Persistent,


what is comparable and comparator interface?

1 Answers  


Categories