• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static and instance variables  RSS feed

 
Daniele Barell
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I'm fallowing Head First Java chapter on GUI.
Following the code:



I cannot understand why the JFrame j and MyDrawPanel dm are static rather than instance variables.
 
Stephan van Hulst
Saloon Keeper
Posts: 7992
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because the application only needs one. I agree that it's poor programming, and you should not emulate this type of code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!