hacker rank java 4th solution

4. Java Stdin and Stdout II

import java.util.*;
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 myString = scan.nextLine();
myString += scan.nextLine();
System.out.println("String: " +myString);
System.out.println("Double: " + d);
System.out.println("Int: " + i);
}
}




Success
Input (stdin)Download
42
3.1415
Welcome to HackerRank's Java tutorials!
Expected OutputDownload
String: Welcome to HackerRank's Java tutorials!
Double: 3.1415
Int: 42
{-truncated-}


Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions