Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't make static reference to method  RSS feed

 
simplex du
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what cause this compilation error?--thanks
 
Kathy Rogers
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere within your code, you're making a call to an instance method of a class - but you're doing that from within a static method so you're not calling that method on a specific instance. For example, you might be doing something like this:-

whereas what your main method needs to look like it this:-

or alternatively, it might be appropriate to make the printMessage method static.
Hope this helps,
Kathy
[ June 26, 2002: Message edited by: Kathy Rogers ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!