• Advertisement
Sign in to follow this  

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

This topic is 2058 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