-2
我想知道爲什麼我的程序無法在Java博士上正確編譯。我的代碼有問題嗎?Dr Java;爲什麼不編譯?
實踐測試#1
import java.util.Scanner;
public class practest1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //reads keyboard input
System.out.println("please input a string, float or integer"); //asks the user to input into the text field.
String twine; //names string with variable name of "twine".
float wood; //names float with variable name of "wood".
int maths; //names int with the variable name of "maths".
System.out.println("Please type a string (please input words"); //asks the user to input a sting.
twine = sc.nextLine(); // links twine to the entered input
System.out.println("Thanks for entering a string" + twine); //displays twine on the screen to siqnify what the user entered
System.out.println("Please type a float (please input decimal point number"); //asks the user to input a decimal point number.
wood = sc.nextFloat(); // links wood to the entered input
System.out.println("Thanks for entering a float" + wood); //displays wood on the screen to siqnify what the user entered
System.out.println("Please type a int (please input a number"); //asks the user to input a number.
maths = sc.nextInt(); // links maths to the entered input
System.out.println("Thanks for entering some integer" + maths); //displays maths on the screen to siqnify what the user entered
}
}
謹慎告訴我們錯誤是什麼? – Reimeus 2015-04-05 23:06:38
您向我們展示的代碼編譯。 http://ideone.com/xJK74X – Radiodef 2015-04-05 23:12:11