What is the difference between static and non-static
variables?
Answer Posted / sandhya reddy
Static Variables are loading when class is loading to the JVM.
Non-Static Variables are loading only when an object is
creating for the particular class.Non- Static variables
can't use inside Static Methods untill and unless creating
an object of that class.with the object reference only we
can asle to use Non-static variables inside Static methods,
But inside Non-Static methods we able to use static
variables without creating any object.
| Is This Answer Correct ? | 11 Yes | 6 No |
Post New Answer View All Answers
Can a class have multiple subclasses?
What is the purpose of the return statement?
What do you understand by the term string pool?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
What is the diffrence between inner class and nested class?
What is arguments in java?
What are the types of sockets in java?
what is the volatile modifier for? : Java thread
What is the method to expand and collapse nodes in a jtree?
What does int [] mean in java?
What is overloading and overriding in java?
What is the difference between quicksort & mergesort? When should they be used? What is their running time?
When do you get classcastexception?
What does escaping a character mean?
Explain the difference between arraylist and linkedlist in java?