0

In the Below code why the String c = input.nextLine() is not working here?I am trying this on Eclipse IDE.

import java.util.Scanner;

public class DataTypes {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int i = 4;
        double d = 4.0;
        String s = "Hackerrank";
        int a = input.nextInt();
        double b = input.nextDouble();
        String c = input.nextLine();
        System.out.println(i+a);
        System.out.println(b+d);
        System.out.println(s+" "+c);
    }
}
  • What does "not working here" mean? What are you expecting? What is happening instead? – Stewart Jul 13 '17 at 09:36
  • It's not taking input in the String c. I can input values in b,c then the flow directly goes to printing. It's actually skipping the String input line. – Kaushik Lahiri Jul 14 '17 at 05:15

0 Answers0