What is the difference between static and non-static
variables?

Answer Posted / sathya

Static variables:
There is only one copy of static variable and even
when the class is instatiated, the value remains the same.

Non-static variables:
Every time the class is instatiated, the objest has
their own copy of these variables.

Is This Answer Correct ?    72 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you check if two strings are equal in java?

595


What is the dot operator?

579


What is anagram word?

529


Why runnable interface is used in java?

582


What is the length of a string?

539






What is == in java?

580


Explain about the select method with an example?

596


For class CFoo { }; what default methods will the compiler generate for you>?

630


What does sizeof return?

567


What is arrays sort in java?

581


Can list be null in java?

592


How many bits is a string in java?

587


What is the purpose of skeleton and stub?

594


Explain the difference between private, public, package and protected in java?

613


What are streams?

644