This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Tomendra Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jackie Gleason
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!