This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes object and instance variable says that they can change at runtime. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object and instance variable says that they can change at runtime." Watch "object and instance variable says that they can change at runtime." New topic
Author

object and instance variable says that they can change at runtime.

Tomendra Singh
Ranch Hand

Joined: Jun 28, 2008
Posts: 47
hi all,
i am studying head first java,in 2nd chapter there is line which says"i can change at runtime--object, instance variable"

firstly i am confused that "object and instance variable can change something" or it is " they can be changed at run time"

whichever exists,

then please help me to understand that.if possible then please with an example.

thank you very much.


Strength Is Life,Weakness Is Death- Swamy Vivekanand.
SCJP 5.0(87%)
Jackie Gleason
Greenhorn

Joined: Aug 12, 2008
Posts: 8
I will venture a guess....

I believe it is saying an Object's Instance Variables can be changed at run-time. This means that when an object is created a new copy of the variable is created....

Think of it like this Instance variables are different for each instance of the class(object) while static variable values are shared throughout all instances of the object.

The only type of variables that cannot be "changed" at runtime are final variables.

Does that help?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43368
    
  32
Like that.
 
 
subject: object and instance variable says that they can change at runtime.
 
It's not a secret anymore!