• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with Instance Variable and fields  RSS feed

 
Joe Simpson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I am completely lost when it comes to the difference between instance variable(non-static fields) and class variables(static fields)? I have looked and researched for the past couple of hours and for some reason I can not figure out what instance really even means in this context? I am just completely lost when it comes to this. Can someone I guess dumb it down for me? Thanks.
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you experimented with some small programs? That's one of the best ways to understand.

The references to the static variable common through instances on lines 17, 18, 20, 23, 24 is not good practice but it demonstrates the behavior of static variables. Basically, static or class variables are shared by all instances. Instance variables are specific to each object/instance.
 
Tim Brelsford
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This video will help
https://www.youtube.com/watch?v=T8dNBmK40d0
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!