Eclipse中的错误 - 找不到Mainclass [英] Error in Eclipse - Mainclass not found

查看:418
本文介绍了Eclipse中的错误 - 找不到Mainclass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编程方面是新的,我很喜欢它。我刚刚下载了Eclipse,我收到一个我无法帮助的错误。不幸的是它是在德国,但意思是:主要类没有找到 - Fehler:Hauptklasse konnte nicht gefunden oder geladen werden



我明白它有东西与 public static void main(String [] args)有关。
由于这是对我来说是全新的事实,您可以很高兴帮助我。



下面的错误源代码;

  / ** 
*在这里写一个类Light的描述。
*
* @author(Sunny)
* @version(31.01.2014)
* /

public class Elevator {
/ /变量

int maxCarr; //最大携带KG
int currentCarr; //当前状态的进位测量在人
boolean fillCondition; //提交或空 - 值false =空
int currentStage; //电梯保持的阶段


//构造函数
public Elevator()//启动
{
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)//设置进入电梯
{
currentCarr = carry;
if(currentCarr!= 0){
fillCondition = true;
return 1;
} else {
return 0;
}
}

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


解决方案

我发现另一个错误。

  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.

这篇关于Eclipse中的错误 - 找不到Mainclass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆