java编译出错
import java.io.*;
class ReadStringOrInt
{
public static void main(String args[])
{
byte buf[]=new byte[20];
String str;
int anInt;
try
{
System.in.read(buf);
str=new String(buf,0);
anInt=Integer.parseInt(str.trim());
}
catch(Exception e){}
}
}
出现
D:\java\3.11> javac ReadStringOrInt.java
Note: ReadStringOrInt.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
谁能帮忙解答下...
------解决方案--------------------要么用低版本的JDK
要么
str=new String(buf, "GBK ");
等等
很多方式