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

Why java strings are immutable in nature?

590


What does provide mean construction?

552


What is the main function in java?

529


How do you represent a space in regex java?

522


What is the synchronized method modifier?

594






Explain methods specific to list interface?

555


State the difference between creating string as new () and literal.

521


which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?

9230


Why do we create threads in java?

578


what is the difference between process and thread? : Java thread

563


Which arithmetic operations can result in the throwing of an arithmeticexception?

597


What are different exception types exceptions available in java ?

475


Can I uninstall java?

553


What is balanced tree in java?

534


What is compareto?

544