且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Eclipse中的错误 - 找不到Mainclass

更新时间:2023-11-17 22:55:46

我发现另一个错误。

  public int(int carry)//设置进入电梯
{
currentCarr = carry;
if(currentCarr!= 0){
fillCondition = true;
return 1;
} else {
return 0;
}
}

方法不能调用'int 即可。该名称由Java语言保留。


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;
        }
    }
}

I found another error.

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

Method can't be called 'int'. This name is reserved by the Java language.