简体   繁体   中英

Unable to compile through command prompt

import java.io.DataInputStream;

class Reading{

    public static void main(String ar[]) throws Exception {
        DataInputStream din = new DataInputStream(System.in);

        int intNumber = 0;
        float floatNumber = 0.0f;

        System.out.println("Enter integer and float number");

        intNumber = Integer.parseInt(din.readLine());
        floatNumber = Float.valueOf(din.readLine()).floatValue();

        System.out.println("Integer" + intNumber);
        System.out.println("Float" + floatNumber);
    }
}

/* Output

Note: Reading.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

*/

You are actually compiling fine. The output contains some warnings as you seems to use some deprecated APIs.

DataInputStream.readLine() is deprecated method. It will work fine for now but recommended to use some Reader stream( BufferedReader ) to read the date.

不推荐使用din.readLine() ,您可以使用javac -Xlint YouClass.java在下次查看错误。

This is only a warning you can still get your output

for details about deprecated Api refer to

Deprecated Api Details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM