Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners variables are **called instance variables because they are created** whenever an object of the class is instantiated.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ramakrishna
variables are **called instance variables because they are created** whenever an object of the class is instantiated.
2 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


i am new to java and also to the programming world at large.

Data is encapsulated in a class by placing data fields inside the body of the class definition. These variables are called instance variables because they are created whenever an object of the class is instantiated.

This is the notes I was given relating to instance variables.

In this notes, what I could not understand is this

These variables are called instance variables because they are created whenever an object of the class is instantiated.

How is it that they are created whenever an object of the class is instantiated.

Please explain this concept with examples in details

thanks What I could not understand is this Created concept.

Could you please explain this in detail that is this Created concept


Advertisement
View Answers

May 27, 2011 at 4:57 PM


Instance variables are any variables, without "static" field modifier, that are defined within the class body and outside any class's methods body.

For more information, visit the following link:

Java Instance Variables



May 27, 2011 at 4:59 PM


An instance variable is a variable which is related to a single instance of a class. Each time an instance of a class is created, the system creates one copy of the instance variables related to that class.



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com