【发布时间】:2013-09-15 16:17:56
【问题描述】:
我是 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)
【问题讨论】:
-
你设置了JAVA_HOME
-
不,我没有?这会有帮助吗?
-
确实有帮助。这些名称的文件夹不存在,因此这不是问题
-
右键项目>属性>运行>浏览主类(是小写的?????)我不记得这样做了。
标签: netbeans