My code is not working plz help | Sololearn: Learn to code for FREE!

My code is not working plz help

import java.util.Scanner; public class main { public static void main(String[] args) { Scanner scanner = new Scanner(; System.out.println("Hi There"); System.out.println("What is your name"); String name = scanner.nextLine(); System.out.println(name+" is a nice name"); System.out.println("What us your age "+ name); int age = scanner.nextInt (); scanner.nextLine (); } }

30th Jun 2022, 9:48 AM
Parcos Gaming
Parcos Gaming - avatar
1 Resposta
+ 1
It is working fine and you don't have to remove scanner.nextLine(); but it would be better to store it as a variable so that you can use it. And because you have scanner.nextLine(), you must provide 3 inputs, not 2.
30th Jun 2022, 10:13 AM
Justice - avatar