[HELP][JAVA][Eclispse] Eclipse error with main
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.
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;
public static void main(String args[])
{
MainClass mc = new MainClass();
int len = mc.stats.length;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement