Error in Eclipse - Mainclass not found

2019-02-28 09:15发布

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 something like: "Main class not found" - "Fehler: Hauptklasse konnte nicht gefunden oder geladen werden"

I understand that it has something to do with "public static void main(String [] args)". Due to the fact that this is totally new to me it would be cool you could assist me.

Below the error source code;

/**
 * Write a description of class Light here.
 * 
 * @author (Sunny)
 * @version (31.01.2014)
 */

public class Elevator {
    // Variables

    int maxCarr; // max. carry in KG
    int currentCarr; // current state of carry measured in people
    boolean fillCondition; // filed or empty - value false = empty
    int currentStage; // stage where elevator remains


    // Constructor
    public Elevator() // initiation
    {
        maxCarr = 1600;
        currentCarr = 0;
        fillCondition = false;
        currentStage = 0;
        System.out.println("**********");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("*        *");
        System.out.println("**********");
    }

    public int  (int carry) // Setting carry into the elevator
    {
        currentCarr = carry;
        if (currentCarr != 0) {
            fillCondition = true;
            return 1;
        } else {
            return 0;
        }
    }

    public void move(int stage) {
        if (stage > currentStage) {
            System.out.println("moving up");
            currentStage = stage;
        } else {
            System.out.println("moving down");
            currentStage = stage;
        }
    }
}

7条回答
劫难
2楼-- · 2019-02-28 10:19

Thanks for the great answers and the error correction. What I still don't understand is where to put public static void main (Strng[] args) and why at the position X. My understanding is as followed.

  1. Definition of instance variables
  2. Set constructor
  3. Definition of methodes

Do I have to put "public static void main (Strng[] args)" before 1 or after 3?

And also When I look at "public static void main (Strng[] args)" from my point of view I create an String Array, correct? But why is that the case? All I want to do is to work with numbers.

Cheers & thank you, Sunny

查看更多
登录 后发表回答