0

this code actually inside if statements (to decide if it a lecturer or student, but the problem are same for both, the input name got skipped) Lecturer a = new Lecturer();

        System.out.print("Please enter your Lecturer Identification Number, Sir : ");
        input.nextLine();
        a.setLect_num(input.nextLine());

        System.out.print("\nPlease insert your Name, Sir : ");
        a.setName(input.nextLine());

        System.out.print("\nPlease enter your Age, Sir : ");
        a.setAge(input.nextInt());

        System.out.print("\nPlese enter the course you are in charge, Sir : ");
        input.nextLine();
        a.setCourse(input.nextLine());

        a.setOccupation("Teacher");
        a.introduction();
Azu
  • 13
  • 3

1 Answers1

1

In line 2 of your code snippet, you are collecting input from the scanner and discarding it:

System.out.print("Please enter your Lecturer Identification Number, Sir : ");
input.nextLine();  // this line is gathering input and discarding it
a.setLect_num(input.nextLine());
Jason
  • 11,258
  • 3
  • 39
  • 46