Sign in to follow this  

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

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

This topic is 1989 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this