What Is an Instance Variable?

In class declarations, attributes are represented by variables. Such variables are called instance variables and are declared inside the class declaration but outside the other member methods of the class. Each object of the class maintains its own copy of the instance variables.

Instance variable

Right!
In class declarations, attributes are represented by variables. Such variables are called instance variables and are declared inside the class declaration but outside the other member methods of the class. Each object of the class maintains its own copy of the instance variables.
Name
Instance variable
Name
The instance variables
Meaning
Defined in a class but outside any method
In class declarations, attributes are represented by variables. Such variables are called instance variables and are declared inside the class declaration but outside the other member methods of the class. Each object of the class maintains its own copy of the instance variables.
It is a reference to i through a class instance, so it belongs to a given object. The instance variable has the letter @, for example:
@hello = hello
Instance variables can be obtained from outside the class to which they belong, but only through accessor methods.