0

Why this NoSuchElement java error is coming?

https://code.sololearn.com/cF8xE16q05KV/?ref=app

29th May 2020, 3:58 PM
Souptik Nath
Souptik Nath - avatar
15 odpowiedzi
+ 2
SOUPTIK NATH Check this Edited By me. Read problem again. https://code.sololearn.com/clXeNl2b7soO/?ref=app
29th May 2020, 5:20 PM
A͢J
A͢J - avatar
+ 2
SOUPTIK NATH You can pass Scanner object as a parameter. No need to create 2 object.
29th May 2020, 4:17 PM
A͢J
A͢J - avatar
+ 2
SOUPTIK NATH Give some time.
29th May 2020, 4:19 PM
A͢J
A͢J - avatar
+ 2
SOUPTIK NATH I had taken Scanner as a parameter Because Sololearn is giving exception.
29th May 2020, 5:42 PM
A͢J
A͢J - avatar
+ 2
SOUPTIK NATH Sololearn terminal is different. Maybe because of online compiler.
29th May 2020, 5:44 PM
A͢J
A͢J - avatar
+ 2
Where do you specify your constructor?
30th May 2020, 7:03 AM
Jyothirani
Jyothirani - avatar
29th May 2020, 5:40 PM
Souptik Nath
Souptik Nath - avatar
0
Why you are taking input in 2 different methods. Take in main method and pass the array in another method.
29th May 2020, 4:06 PM
A͢J
A͢J - avatar
29th May 2020, 4:15 PM
Souptik Nath
Souptik Nath - avatar
0
AJ #Infinity Love How please give the syntax
29th May 2020, 4:19 PM
Souptik Nath
Souptik Nath - avatar
0
AJ #Infinity Love Please modify my code and share it please
29th May 2020, 4:19 PM
Souptik Nath
Souptik Nath - avatar
29th May 2020, 4:20 PM
Souptik Nath
Souptik Nath - avatar
0
AJ #Infinity Love The examiner will cut my answer as in the below line its given void inputArray() which will not take any parameters but here its taking Scanner object as parameter. void inputArray(Scanner sc) { for(int i = 0; i < n; i++) { num[i] = sc.nextInt(); } } Update:The program is also not working properly.
29th May 2020, 5:25 PM
Souptik Nath
Souptik Nath - avatar
0
SOUPTIK NATH Problem was in your logic. Now Check again.
29th May 2020, 5:33 PM
A͢J
A͢J - avatar
0
AJ #Infinity Love Why SoloLearn is not 100% perfect?
29th May 2020, 5:43 PM
Souptik Nath
Souptik Nath - avatar