What is static variable and static method?

Answer Posted / govardhani

A static variable is a variable who's single copy in memory
is shared by all objects,so any modifications to the static
variable will modify it's value in all objects.

In classes, a static method is one that is called without an
instance of that class, while a non-static method is called
by instances of the class.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is java still necessary?

621


What are the two parts of a conditional statement?

514


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

589


What's the difference between comparison done by equals method and == operator?

546


Why use string handling in Java?

581






Are static members inherited to sub classes?

638


What is the same as procedures?

532


What is main string [] args?

522


What is the purpose of checked and unchecked exceptions in JAVA?

566


Why does java not allow multiple public classes in a java file ?

3443


Is array primitive data type in java?

534


Where to store local variables?

581


What are the Class Libraries ?

595


How do you get the length of a string in java?

518


Explain some best practices you would apply while using collection in java?

569