java stdin and stdout ii

Solutions on MaxInterview for java stdin and stdout ii by the best coders in the world

showing results for - "java stdin and stdout ii"
Juliette
10 Mar 2017
1//for java8 
2
3import java.util.Scanner;
4
5public class Solution {
6    public static void main(String[] args) {
7        /* Read input */
8        Scanner scan = new Scanner(System.in);
9        int i    = scan.nextInt();
10        double d = scan.nextDouble();
11        scan.nextLine();              // gets rid of the pesky newline
12        String s = scan.nextLine();
13        scan.close();
14        
15        /* Print output */
16        System.out.println("String: " + s);
17        System.out.println("Double: " + d);
18        System.out.println("Int: " + i);
19    }
20}
21