In this HackerRank Java Stdin and Stdout II problem in the java programming language you must read an integer, a double, and a String from stdin, then print the values according to the instructions in the Output Format.

HackerRank Java Stdin and Stdout II solution


HackerRank Java Stdin and Stdout II problem solution.

import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int i = scan.nextInt();
        double d = scan.nextDouble();
    String s = scan.nextLine();
    s = scan.nextLine();

        // Write your code here.

        System.out.println("String: " + s);
        System.out.println("Double: " + d);
        System.out.println("Int: " + i);
    }
}


Second solution in java 8 programming

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
			Scanner sc=new Scanner(System.in);
			int x=sc.nextInt();
			double y=sc.nextDouble();
			sc.nextLine();
			String s=sc.nextLine();
			
			
			System.out.println("String: "+s);
			System.out.println("Double: "+y);
			System.out.println("Int: "+x);
	}
}


import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String intLine = s.nextLine();
        String floatLine = s.nextLine();
        String sentence = s.nextLine();
        System.out.println("String: " + sentence);
        System.out.println("Double: " + Double.parseDouble(floatLine));
        System.out.println("Int: " + Integer.parseInt(intLine));
    }
}