0

This is my code:

Scanner kb = new Scanner(System.in);        
    int a = kb.nextInt();
    String word = kb.nextLine();
    System.out.println("Hello");        
    System.out.println("World");
    System.out.println(word);

The result is:

123
Hello
World

123 is my input for integer, but it didn't ask for any input for my word variable. Different case for .next(). It works but It can only print 1 word instead of 2+ if I put more than 2 words in my String word variable.

Reinaldo
  • 3
  • 2

0 Answers0