How can I name scanner ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I name scanner ?

i want to use scanner method to ask how much money do you want to withdraw . The box is opening and requesting user for input. how can i name it so user will see what kind of input is needed? https://code.sololearn.com/cLDko43EqHoS/?ref=app

19th Apr 2018, 12:14 PM
Paweł Grünholz
Paweł Grünholz - avatar
5 Answers
+ 6
You cannot do that in SoloLearn, unfortunately. However, you can add comments to your code. Comments can introduce the visitors to the input format ;)
19th Apr 2018, 1:07 PM
Dev
Dev - avatar
+ 5
Other tip: handle Exception try{ your code} catch (java.util.InputMismatchException e){ System.out.print("enter integer");} catch (Exception e){ System.out.print("enter integer");}
19th Apr 2018, 1:31 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 2
Use System.out.println(); but here on sololearn it doesn't show that because it takes input before the program runs
19th Apr 2018, 1:07 PM
LordHill
LordHill - avatar
+ 1
ehh so bad, every input looks the same here and user doesnt know what to write there. anyway thanks for your help. comments will be added as soon as program start working
19th Apr 2018, 1:10 PM
Paweł Grünholz
Paweł Grünholz - avatar
+ 1
heh nice idea! i am a totally beginner and forgot that we have some helpful tool like exceptions 😀
19th Apr 2018, 1:48 PM
Paweł Grünholz
Paweł Grünholz - avatar