Why Static variable required in java?For ex,class A
{
static int a;
int b;
}
Why static is required?

Answer Posted / aswini

Without using instance of the class means no need to use the class object to call static variable insted directly use the classname to use the static variable.moreover ,only one copy of static varible avaible to use all the classes.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the paint() and repaint() methods in java programming?

616


What is sortedmap in java?

547


What is the use of private static?

531


Explain about arraylist?

571


What is ctrl m character?

510






A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

535


What is java lang object?

523


Can we define constructor in inner class?

535


Can we extend a class with private constructor?

521


What is a top level class in java?

523


What language is java written?

533


Is singleton set an interval?

526


Explain reverse a linked list recursive java solution?

522


What are the rules for naming an array?

520


Which is the class in java?

512