This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile Error

 
Hanna S?derbergLarsson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I have the following class:

And it gives this compile error:
BumpTest.java:4:In this static context "this" is not accessible (no instance field or method)
Please tell me why!!!
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bumper() is a member of the class, so you can't access it from the static main method. Make bumper static.
Or make an instance of the class and invoke bumper() on the instance.
-Barry
BTW you have another problem with that method, but first get it to compile and run.
[ February 01, 2003: Message edited by: Barry Gaunt ]
 
Hanna S?derbergLarsson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Barry!
And I know about the other problem, that was what I wanted to achieve I'm doing a lot of silly tests right now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic