Plzz help for my problem in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Plzz help for my problem in java

"create a program that will ask for the name and no. of times to display" how can I input a name and no. of times ?? can I use a loop, array ? etc.

8th Apr 2017, 5:23 PM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar
7 Answers
+ 7
It depends, what type of application are you trying to build? for web create one form that will take two input or for console use Scanner class to take two inputs.
8th Apr 2017, 5:29 PM
Tarique Khan
Tarique Khan - avatar
+ 7
Input name in string. Use for/while loop print it multiple times
8th Apr 2017, 5:32 PM
Pixie
Pixie - avatar
+ 7
created a code for you hope it helps you :) run the code in IDE ;) not on playground https://code.sololearn.com/cCc186CWP0s1/?ref=app
8th Apr 2017, 5:39 PM
Muhammad Mujtaba
Muhammad Mujtaba - avatar
+ 6
your welcome brother :-)
8th Apr 2017, 5:59 PM
Muhammad Mujtaba
Muhammad Mujtaba - avatar
+ 6
@Muhammad There's no reason to create a new scanner object for every line of input you take, just use one scanner.
8th Apr 2017, 7:25 PM
Rrestoring faith
Rrestoring faith - avatar
8th Apr 2017, 8:13 PM
Tarique Khan
Tarique Khan - avatar
+ 2
tnx a lot for your code muhammad ahmed😀😀
8th Apr 2017, 5:58 PM
Dexter Torres Gregorio
Dexter Torres Gregorio - avatar