Sign in to follow this  

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

Recommended Posts

aattss3    387
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
dave j    681
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

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