Exception in thread "main" java.lang.NullPointerException at Merit.main(Student.java:42) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Exception in thread "main" java.lang.NullPointerException at Merit.main(Student.java:42)

Hello I'm trying to solve this problem but I couldn't find any solution here I'm writting the code : https://code.sololearn.com/c5R83jup51lh Don't run it on sololearn playground. Run it on desktop u will be directed what to input.

23rd Jul 2017, 1:16 PM
Darshil Shah
Darshil Shah - avatar
6 Answers
+ 4
I found the error I haven't initialized array object properly therefore Memory was not allocated and it was returning null pointer exception one silly mistake eats hours and hours!☺
24th Jul 2017, 6:35 AM
Darshil Shah
Darshil Shah - avatar
+ 2
I always recommend to use only one scanner per method. And then call next () twice.
23rd Jul 2017, 11:22 AM
Jonas Schröter
Jonas Schröter - avatar
+ 1
Could you please show your code in playground? It's difficult to find mistakes and the right line.
23rd Jul 2017, 11:17 AM
Jonas Schröter
Jonas Schröter - avatar
+ 1
What am I supposed to input?
23rd Jul 2017, 1:26 PM
Jonas Schröter
Jonas Schröter - avatar
0
I have no chance to run it on desktop, sorry.
23rd Jul 2017, 4:23 PM
Jonas Schröter
Jonas Schröter - avatar
0
Good😂
24th Jul 2017, 6:38 AM
Jonas Schröter
Jonas Schröter - avatar