java - Java博士;为什么不编译呢?

我想知道为什么我的程序无法在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

    }
}

最佳答案

如注释中所示,我认为它可以编译。尝试确保您的文件名与类名相同!

https://stackoverflow.com/questions/29463211/

相关文章:

java - 为什么我无法定义数组?

c++ - ISO C++禁止声明多集

java - vlcj 在尝试创建服务器流时出错

java - Unresolved 编译问题: The method parseInt(String

c++ - 尝试编译我的wxWidgets程序时出现 “is_enum not declared i

c# - 并非所有代码路径都返回值: Unity

sql-server - 从以下脚本获取错误

java - 错误 : variable data might not have been init

c++ - 错误 : too many template-parameter-lists

java - 如何调用其他类(class)的名单?