我无法理解问题出在哪里,因为System.in.read()
不给ascii字符串,所以使用Integer.parseInt
必须解决它,并且必须返回在控制台上输入的值。.
我在编译时抛出错误,无法将String
转换为int
类型。
请检查并告诉我哪里出了问题。
import java.io.IOException;
class AB
{
public static void main(String[] args)throws IOException
{
int a = Integer.parseInt(System.in.read());
System.out.print(a);
}
}