无法编译的源代码-错误的sym类型: [英] Uncompilable source code - Erroneous sym type:

查看:105
本文介绍了无法编译的源代码-错误的sym类型:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第14行发生了错误.

线程主"中的异常java.lang.RuntimeException:无法编译源代码-错误的符号类型:

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

推荐答案

您提供的代码在我的计算机上运行良好.

The code you provided runs fine on my computer.

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

I'm guessing you are using Netbeans and may be affected by a bug. Try this:

打开项目属性,选择Build-Compiling,取消选中保存时编译",然后重新运行应用程序.这样可以确保在运行之前重新编译所有源代码.

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

这篇关于无法编译的源代码-错误的sym类型:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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