For example:
Scanner scanner = new Scanner(System.in);
String myString = scanner.next();
int myInt = scanner.nextInt();
scanner.close();
System.out.println("myString is: " + myString);
System.out.println("myInt is: " + myInt);
Task
In this challenge, you must read integers from stdin and then print them to stdout. Each integer must be printed on a new line. To make the problem a little easier, a portion of the code is provided for you in the editor below.
Input Format
There are 3 lines of input, and each line contains a single integer.
Sample Input
42
100
125
Sample Output
42
100
125
Solution:
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
// Complete this line
int b = scan.nextInt();
// Complete this line
int c = scan.nextInt();
System.out.println(a);
// Complete this line
System.out.println(b);
// Complete this line
System.out.println(c);
}
}