Jump to content
  • Advertisement
Sign in to follow this  
aattss3

[HELP][JAVA][Eclispse] Eclipse error with main

This topic is 2333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. As you see, I made a little thingamajig to try to help me learn Java, but then I decided to reorganize it, and it had a lot of errors. I fixed a lot of it, but now it says "selection does not contain main type". I have attached everything in the form of .txt.

Share this post


Link to post
Share on other sites
Advertisement
Your main() method must be static - but then you'll have a problem accessing your instance variables from a static method. The solution is to create an instance of the MainClass in your main() method and access your variables via that. e.g.

public static void main(String args[])
{
MainClass mc = new MainClass();
int len = mc.stats.length;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!