0

Scanner Error

Hello i need help with scanner comand https://code.sololearn.com/cUvzpHoX3Tol/?ref=app

8th Jun 2019, 1:47 AM
Angel
4 ответов
0
https://code.sololearn.com/cENJPxC3h8SQ/?ref=app
8th Jun 2019, 2:34 AM
Ghost rider
0
import java.util.Scanner instead of import util.java.Scanner You have initialized variable "name" with both int and Scanner data type
8th Jun 2019, 2:37 AM
Ghost rider
0
Hey, I edited your code, take a look at it here - it's got comments with explanation but in short: - You used util.java instead of java.util - Scanner name is ambiguous, you might use it to get user age, date of birth, any string so just calling it "scanner" or sc or userInput is better than calling it 'name' - you used int for name, I assume it's better to use String for text https://code.sololearn.com/cFAgHIqTE0R3/?ref=app
8th Jun 2019, 2:38 AM
HNNX 🐿
HNNX 🐿 - avatar
0
//Scanner name = new // Scanner (System.in); // name = in.nextLine () ; Scanner in = new Scanner(System.in); String name = in.nextLine ();
8th Jun 2019, 7:55 AM
zemiak