import java.io.*;
class abbad
{
public static void main(String[] args)
{
try
{
int n=(int)System.in.read();//这句可以吗
}
catch(IOException e) {}
System.out.println("输入的n的值为:"+n);
}
}
class abbad
{
public static void main(String[] args)
{
try
{
int n=(int)System.in.read();//这句可以吗
}
catch(IOException e) {}
System.out.println("输入的n的值为:"+n);
}
}
将输入信息的下一个标记扫描为一个 int。
class abbad
{
public static void main(String[] args)
{
try
{
//int n=(int)System.in.read();//这句可以吗
Scanner s=new Scanner(System.in);
int n=s.nextInt();
System.out.println("输入的n的值为:"+n);
}
catch(Exception e) {}
}
}
import java.io.IOException;
import java.io.InputStreamReader;/**
*
* @author zm
*/
public class Main { /**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException
{
// TODO code application logic here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String value = br.readLine();
int i = -1;
try
{
i = Integer.parseInt(value);
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("result: " + i);
}}