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
What is fail first in java?
What is the main use of generics in java?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
What are the advantages of inner classes?
What is singleton class and how can we make a class singleton?
What is the difference between arraylist and hashset in java?
What is thread safe java?
What is the use of coding?
Can a main method be declared final?
Can we catch more than one exception in a single catch block?
What are sets in java?
Is there any way to skip finally block of exception even if some exception occurs in the exception block?
What is java util concurrentmodificationexception?
Where is the find and replace?
What do you mean by append?