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 an objects lock and which objects have locks? : Java thread
What is the range of the short type?
What is the null?
What is the original name of java?
What is thread safe in java?
Can a class be a super class and a sub-class at the same time? Give example.
What is stringjoiner ?
What is the lifetime and scope of a variable?
In case of inheritance what is the execution order of constructor and destructor?
explain different ways of using thread? : Java thread
What is difference between == equals () and compareto () method?
What is default switch case? Give example.
What are the important features of Java 9 release?
What do you mean by an interface in java?
What is the platform?