Variables associated with the instance of a class are called instance variables. Whenever a class is instantiated, the runtime system creates a separate copy of each instance variable defined by the class. Therefore, each instance of a class has its own copy of all instance variables defined by the class.
If an instance variable is in the scope, it can be accessed simply by its name. However, if it is not in the scope, it is accessed by its name qualified by the object reference along with a dot operator as shown below:
where, objreference is the name of the variable holding the reference of the object and instancevar is the name of the instance variable associated with that object.
- Best exam simulation SUN scja download free trial.
- Become SUN SCJA certified.
- Download free practice test for 310-035 SCJP 2 exam.
- Download practice question and study guide for CX310-036 for exam.
- Get certified in first attempt download CX310-055 - Java 5.0 simulation.
- Get certified in first attempt download CX310-056 - SCJP 5.0 Java Upgrade simulation.
- Get certified in first attempt download CX310-065 - SCJP 6.0 simulation.
- Click here to get free CX310-066 SCJP Upgrade exam practice questions.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.