0
    import java.util.Scanner;

    public class Solution {

    public static void main(String[] args) {
     Scanner scan = new Scanner(System.in);

     int i = scan.nextInt();
     String s = scan.nextLine();
     double d = scan.nextDouble();

    // Write your code here.

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

So my String s = scan.nextLine(); isn't working, I'm not too sure if why but it doesn't display the output. If I rearrange it and put it above int i=scan.nextInt(); everything else below it doesn't display an output.Can someone help me figure out why is this?

Practice problem from hackerrank to scan and print

0 Answers0