0
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);
    }
}
Karl Knechtel
  • 51,161
  • 7
  • 77
  • 117

0 Answers0