gpt4 book ai didi

java - 启动 Java (Eclypse) 时出现奇怪错误

转载 作者:行者123 更新时间:2023-11-30 04:34:26 26 4
gpt4 key购买 nike

我阅读了有关此问题的讨论,但找不到解决方案!

我编写了一个非常简单的程序,但是当我启动它时,出现此错误:

           << Selection does not contain a main type >>

预先非常感谢您对我的帮助。我是 Java 新手:/

<小时/>
public class Implementation{

public static void Main(String args[]){

Operations_numbers operations;
operations = new Operations_numbers();

int subtraction = operations.subtraction(10,2);
String result_Comparison = new String();
result_Comparison = operations.comparison(8,3);

System.out.println(result_Comparison);
System.out.println(subtraction);

}

}
---------------
public class Operations_numbers{

public int subtraction (int x, int y){
int subtraction;
subtraction=x-y;
return subtraction;
}

public String comparison (int x, int y){
if(x>y){
String result="the number" + x + "is bigger than the number" + y;
return result;
}
else{
String result="the number" + y + "is bigger than the numbero" + x;
return result;
}
}

}

最佳答案

main 应为小写。正确的签名是

public static void main(String args[])

关于java - 启动 Java (Eclypse) 时出现奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13827754/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com