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 happens to the Exception object after handling an exception?

1818


What are the pillars of java?

489


When should we create our own custom exception classes?

585


What are the different types of java?

561


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.

1575






What is the difference between preemptive scheduling and time slicing in java programming?

536


What is type parameter in java?

522


What is java english?

496


What is math exp in java?

548


What are the types of relation?

573


What is string [] java?

530


Can we override tostring method in java?

533


When will we prefer to use set and list in java and why?

550


How many bytes are there?

541


Is list ordered in java?

544