Java 爪哇博士;为什么这不是编译?
我想知道为什么我的程序不能在Dr.Java上正确编译。我的代码有问题吗 实践测试#1Java 爪哇博士;为什么这不是编译?,java,compiler-errors,Java,Compiler Errors,我想知道为什么我的程序不能在Dr.Java上正确编译。我的代码有问题吗 实践测试#1 如评论所示,我认为它是编译的。请尝试确保您的文件名与类名相同 能告诉我们错误是什么吗?你给我们看的代码是编译的。 import java.util.Scanner; public class practest1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //reads
如评论所示,我认为它是编译的。请尝试确保您的文件名与类名相同 能告诉我们错误是什么吗?你给我们看的代码是编译的。
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
}
}