हिंदी

Instance Variables

Advertisements

Topics

CISCE: Class 10

Instance variables:

Instance variables are declared within a class but outside methods. They are shared across all objects of the class, referred to as object fields, and hold different values for different objects. 

CISCE: Class 10

Class variables (Static variables):

A class variable is declared within the class but outside the member methods along with the static keyword. A variable declared static will be available as a single copy to be used by all the objects of a class. This common field will be affected irrespective of the objects by which it is handled. 

CISCE: Class 10

Local variables:

Local variables are declared within a method's body and can't be static. Their scope is limited to the method's curly braces, and they require explicit initialization before use.  

Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×