我是Java的新手,但是有一定的编程经验。我正在读一本关于如何用Java语言编程的书。我缺乏对NetBeans和Java的知识,阻碍了我的进步。我的特殊问题是我的输出框中没有看到正确的输出。
不管代码。

这是一个例子。我确定我缺少一个小细节:

public class Weather
{
    public static void main(String[] arguments)
    {
        float fah = 86;
        System.out.println(fah + " degrees Fahrenheit is ...");
        //To conver fahrenheit to Celsius
        //Begin by subtracting 32
        fah = fah - 32;
        //divide the answer by 9
        fah = fah / 9;
        //multiply that answer by 5
        fah = fah * 5;
        System.out.println(fah + "degree Celsius is ...");

        float cel = 32;
        System.out.println(cel + "degress Celsius is ...");
        //To convert Farhenheit to celsius
        //begin by multiplying 9
        cel = cel * 9;
        //divide answer by 5
        cel =cel / 5;
        //add 32 to the answer
        cel = cel + 32;
        System.out.println(cel + "degrees Farenheit");

        }
}

输出盒:
run:
Error: Could not find or load main class weather.Weather
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

最佳答案

关闭netbeans,然后删除此目录C:\ Users \您的名称此处\ AppData \ Local \ NetBeans \ Cache

再次启动Netbeans,让它读取项目。

测试项目。运行项目。它应该工作正常。

10-05 19:45