gpt4 book ai didi

java - 无法编译的源代码 - 错误的符号类型 :

转载 作者:搜寻专家 更新时间:2023-10-31 08:18:58 27 4
gpt4 key购买 nike

第 14 行发生错误。

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type:

很难找到解决方案。

package example;

public class Num
{
public static void main(String [] args)
{
String s = "42";
try
{
s = s.concat(".5");
double d = Double.parseDouble(s);
s = Double.toString(d);
int x = (int) Math.ceil(Double.valueOf(s).doubleValue()); //Line 14
System.out.println(x);
}
catch (NumberFormatException e)
{
System.out.println("Wrong Number");
}
}
}

最佳答案

您提供的代码在我的电脑上运行良好。

我猜您正在使用 Netbeans 并且可能受到错误的影响。试试这个:

Open the project properties, select the Build-Compiling, uncheck "Compile on save" and rerun the application. This will make sure all your source code becomes recompiled before running it.

链接:https://forums.netbeans.org/topic43241.html

关于java - 无法编译的源代码 - 错误的符号类型 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35114025/

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