0

Can you help me in this Input error please

in the output is not let me enter the last name The output: Enter first name: shaima Enter last name: Error: Database connection; cannot add the stduent , shaima https://code.sololearn.com/cW1von8azLLx/?ref=app

24th Sep 2021, 7:56 PM
SH S
SH S - avatar
6 Answers
0
you are doing first input before print message about it String firstnamestudent = input.nextLine(); System.out.println("Enter first name:"); so shaima is entered as last name
24th Sep 2021, 8:10 PM
zemiak
0
zemiak can you show me exaple becuse i change what you said but it is not work
24th Sep 2021, 8:19 PM
SH S
SH S - avatar
0
//change code this way System.out.println("Enter first name:"); String firstnamestudent = input.nextLine(); System.out.println("Enter last name:"); String lastnamestudent = input.nextLine();
24th Sep 2021, 8:23 PM
zemiak
0
zemiak not working The output Enter 1 if you want add student of 2 if want add new staff: 1 Enter first name: Enter last name: shaima Error: Database connection; cannot add the stduent , shaima
24th Sep 2021, 8:27 PM
SH S
SH S - avatar
0
if before switch is int choice = input.nextInt(); change this to pair int choice = input.nextInt(); input.nextLine();
24th Sep 2021, 8:35 PM
zemiak