0
Scanner Error
Hello i need help with scanner comand https://code.sololearn.com/cUvzpHoX3Tol/?ref=app
4 Respuestas
0
https://code.sololearn.com/cENJPxC3h8SQ/?ref=app
0
import java.util.Scanner
instead of
import util.java.Scanner
You have initialized variable "name" with both int and Scanner data type
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
0
//Scanner name = new
// Scanner (System.in);
// name = in.nextLine () ;
Scanner in = new Scanner(System.in);
String name = in.nextLine ();