package userInput;
import java.util.Scanner;
public class ScannerUserInput {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name = sc.next();
int rollNo = sc.nextInt();
sc.next();
String fieldOfInterest = sc.nextLine();
System.out.println("Hey,my name is " +name );
System.out.println("my roll no. is " +rollNo);
//i dont know why my code is not working second input of string is not giving me the output
System.out.println("my field of interest are " +fieldOfInterest);
}
}
Asked
Active
Viewed 15 times
0
![](../../users/profiles/523612.webp)
Karl Knechtel
- 51,161
- 7
- 77
- 117
-
Please provide full contents of your class ScannerUserInput – Spectric Sep 17 '20 at 01:42
-
It works perfectly fine for me. – Spectric Sep 17 '20 at 01:52