Error in Eclipse - Mainclass not found

后端 未结 5 1925
醉酒成梦
醉酒成梦 2021-01-24 10:01

I\'m new in programing and I like it pretty much. I\'ve just downloaded Eclipse and I got an error I can\'t help me with. Unfortunately it\'s in German but the meaning is someth

5条回答
  •  爱一瞬间的悲伤
    2021-01-24 10:36

    the access point for java is the main method.. every program must access from a main method. and in main method, you need to create an instance of your class to use the method inside main method like following:

    public static void main(String [] args){
      Elevator elevator = new Elevator();
      elevator.move(1);
      ...
    }
    

    and also public int (int carry) // Setting carry into the elevator is not valid format in Java, you have to define a method name like

    public int setCarry(int carry) // Setting carry{
      //your code
    }
    

提交回复
热议问题