1、Scanner
import java.util.Scanner;
Scanner in = new Scanner(System.in);
String s = in.next();
int i = in.nextInt();
double d = in.nextDouble();
2、in.hasNextInt()
if (in.hasNextInt) {
System.out.println(in.nextInt);
}
原文:https://www.cnblogs.com/ss-123/p/8974114.html