Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static method

 
srinivas sridaragaddi
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



doubt: how come static method main is able to access a non static method infiniteLoop()
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you use the instance to call the infiniteLoop(). If you call it directly without using the instance, it won't compile.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic