本文为博主原创文章,未经博主允许不得转载。
hasNext...()读取下一个目标,判断它是否存在
hasNextLine()
hasNextInt()
Next....()读取输入的字符,以空格为分隔符,返回输入的字符
nextLine()读入当前一行
nextInt()读入当前一个整型数据
next()读入字符直到出现第一个空格停下
import java.util.*;
public class prc {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
while(sc.hasNextInt())
//可以参考下C中的EOF
{
int s=sc.nextInt();
System.out.print(s);
}
sc.close();
}
}