• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
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
Pie
Posts: 49364
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic