- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathjava-end-of-file.java
More file actions
Latest commit
26 lines (22 loc) · 654 Bytes
/
Copy pathjava-end-of-file.java
File metadata and controls
26 lines (22 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Java > Introduction > Java End-of-file
// Learn how to read from standard input until EOF.
//
// https://www.hackerrank.com/challenges/java-end-of-file/problem
// challenge id: 8279
//
importjava.io.*;
importjava.util.*;
publicclassSolution {
publicstaticvoidmain(String[] args) {
/*
* Enter your code here. Read input from STDIN. Print output to STDOUT. Your
* class should be named Solution.
*/
Scannersc = newScanner(System.in);
intline = 0;
while (sc.hasNextLine()) {
System.out.printf("%d %s\n", ++line, sc.nextLine());
}
sc.close();
}
}