+ 1
Weird error?
Can somebody please help explain what this error is I'm getting? I'm not sure if I put something wrong with the javas scanner. I didnt think so, but idk why this wont run and just show what username you input. You have to put continue to proceed, then enter a username. It should print the username you typed back out to you. https://code.sololearn.com/cxWjSJEoJx8N/?ref=app https://code.sololearn.com/cxWjSJEoJx8N/?ref=app
2 Antworten
+ 1
Make Scanner object class level. Then you can Use it in both functions through single object. No need to create two objects infact not allowed per class.
0
Instead of making two scanner it's better to create static object if it's not really need to encapsulate it. You can replace the scanner in method to something like this
static Scanner = new Scanner(System.in);