+ 1

How can i let the user enter multiple times in java?

I use Scanner but it enter only one time, I need to know how to make the Scanner enter more than once

23rd Dec 2017, 1:23 PM
@mix_tory
@mix_tory - avatar
3 Answers
+ 1
what is ( n ) ?? i < n ???
23rd Dec 2017, 1:43 PM
@mix_tory
@mix_tory - avatar
0
Keep remember.., When you want something to do for multiple times .,Use loops. As per your question This might help you. Use inside main method. Scanner sc = new Scanner(System.in); for(int i=0;i < n;i++){ int num = sc.nextInt(); }
23rd Dec 2017, 1:34 PM
Bharath_Teki šŸ‡®šŸ‡³
Bharath_Teki šŸ‡®šŸ‡³ - avatar
0
I mean In the place of 'n' you can given the number depending upon how many times you want to enter choice.
23rd Dec 2017, 1:54 PM
Bharath_Teki šŸ‡®šŸ‡³
Bharath_Teki šŸ‡®šŸ‡³ - avatar