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
Is java a software?
How will you reverse a link list without using recursion?
Is it possible for yielded thread to get chance for its execution again ?
What are java threads?
Where is const variable stored?
What is a constructor overloading in java?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
What is the default value of local and global variables?
What is the static method?
What happens if I remove static from main method?
How does arraylist size increase in java?
Can you give few examples of final classes defined in java api?
State two differences between C and Java.
Differentiate between vector and array list.
What are the two ways to create a thread?