• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sttatic vs non static methods  RSS feed

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are some methods stactic and some not? I keep getting errors saying that I cant reference something from a static method.
 
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A static method is one that is associated with a class, not an instance. You cannot directly access an instance method or variable from a static method.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!