gpt4 book ai didi

java - 我应该在此程序中传递什么参数以避免java.lang错误?

转载 作者:行者123 更新时间:2023-12-03 08:24:42 24 4
gpt4 key购买 nike

这是我试图运行的编:

public class RightTriangle {
public static void main(String args[]) {

int a = Integer.*parseInt*(args[0]);
int b = Integer.*parseInt*(args[1]);
int c = Integer.*parseInt*(args[2]);
System.out.println((c*c==a*a+b*b||b*b==a*a + c*c ||a*a == b*b + c*c)&&(c>0 && b>0 && a>0));
}
}
我在IntelliJ上运行此程序时遇到此错误:-
"C:\Program Files\Java\jdk-14.0.2\bin\java.exe" "-javaagent:C:\Users\anuavi\IntelliJ IDEA Community Edition 2020.2.1\lib\idea_rt.jar=58608:C:\Users\anuavi\IntelliJ IDEA Community Edition 2020.2.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\anuavi\IdeaProjects\java1\out\production\java1 RightTriangle console
Exception in thread "main" java.lang.NumberFormatException: For input string: "console"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at RightTriangle.main(RightTriangle.java:7)
流程以退出代码1完成
当我从合法来源复制代码时,我不明白为什么这会显示错误?

最佳答案

您目前正在传递哪些论点?您的应用程序试图将“控制台”字符串转换为数字,因此出现错误:

java.lang.NumberFormatException: For input string: "console"

关于java - 我应该在此程序中传递什么参数以避免java.lang错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63654916/

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