Core Java Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 2354 Page Views: 

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



Posted By: Avi Date: 9 November 2009 06:25:11 AM
 Answer:

A static variable is associated with the class as a whole rather than with specific instances of a class.

On the other hand, non-static variables are associated with the specific instances of a class and takes on unique values with each object instance.


Posted By: eTechPlanet


Date: 9 November 2009 06:25:11 AM

A static variable is associated with the class as a whole rather than with specific instances of a class.

Non-static variables take on unique values with each object instance.


Posted By: Johndecruse


Date: 31 January 2010 10:49:45 PM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image CqvEKi
Related Questions
Core Java : What is numeric promotion?

What is numeric promotion?

Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that inte....
Category: Core Java Date: 11/5/2010 1:20:55 AM
Core Java : What are the restrictions placed on overloading a method ?

What are the restrictions placed on overloading a method ?

Overloading methods must differ in their parameter list, or number of parameters.
Category: Core Java Date: 11/5/2010 12:59:49 AM
Core Java : Which package is always imported by default?

Which package is always imported by default?

The java.lang package is always imported by default.
Category: Core Java Date: 11/5/2010 12:47:55 AM
Core Java : If a class is declared without any access modifiers, where may the class be accessed?

If a class is declared without any access modifiers, where may the class be accessed?

A class that is declared without any access modifiers is said to have package access. This means tha....
Category: Core Java Date: 11/5/2010 12:15:53 AM
Core Java : What is a Java package and how is it used?

What is a Java package and how is it used?

A Java package is a naming context for classes and interfaces. A package is used to create a separat....
Category: Core Java Date: 11/4/2010 9:52:55 PM