import java.util.*;
//...
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
if (sc.hasNextInt()) {
int i = sc.nextInt();
//...
}
Run Code Online (Sandbox Code Playgroud)
File,InputStream和String作为来源(除其他外)
new Scanner(new File("input.txt"))new Scanner("some string you want to tokenize")sc.useDelimiter(";")sc.next("[a-z]+")在stackoverflow的其他地方:
| 归档时间: |
|
| 查看次数: |
1277 次 |
| 最近记录: |