0
import java.util.Scanner;
public class Question_11 {
public void main(String[] args) {
double RATE = 35.75;
double Wages;
double Hours;
Scanner keyboard = new Scanner(System.in);
System.out.print("Please enter the number of hours worked: ");
Hours = keyboard.nextDouble();
//calculate wages
Wages = Hours * RATE;
System.out.println("The calculated wages = " + Wages);
}
}
空指針異常這是我的代碼,我不斷收到此錯誤:在Java中博士
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272)
它編譯,但不會運行。
預先感謝您!
我使用Java博士 – 2014-09-18 22:01:20