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

Answer Posted / vaishnavi

To answer Soumya's question, instance variables are declared at class level, but the instance variables still belong to an instance/object. But static variables belong to a class.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are advantages of exception handling in java?

778


What is meant by oops concept in java?

716


Explain a situation where finally block will not be executed?

755


State the main difference between c++ and java?

770


What is array list in java?

788


Which is the best approach for creating thread ?

928


What is ‘is-a ‘ relationship in java?

779


How to perform linear search in java?

736


What do you mean by data type?

759


How will you communicate between two applets?

834


Explain JMS in detail.

798


What is t in parametric equations?

728


What is variable declaration and definition?

729


What is the structure of java?

734


Is sizeof a preprocessor?

721