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


Please Help Members By Posting Answers For Below Questions

Explain about assignment statement?

594


What is an enumeration?

566


What is the purpose of the system class in java?

551


What is purpose of keyword void?

559


How is Object Oriented Programming different from Procedure Oriented Programming?

587






What is qms certification?

520


Does windows 10 need java?

590


Describe the process as to how substring() methodology mechanisms in java.

554


What are three advantages of using functions?

532


Is sizeof a preprocessor?

541


Is .net better than java?

552


State one difference between a template class and class template.

620


What are the advantages of arraylist over arrays?

564


Can we have any code between try and catch blocks?

553


What is the largest number a double can hold?

556