Help! Why is the output of variable String "null"? ("Dies Game" in my profile) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help! Why is the output of variable String "null"? ("Dies Game" in my profile)

I'm in a process of learning Java. So, I know the code is horible but I really need a help. This is my first programme. Could help me with the problem? Corrections of my code are welcome. ("Dies Game" in my profile) https://code.sololearn.com/cSe5Pmw41NTL/?ref=app

29th Sep 2018, 10:31 PM
Rostislav Kravchenko
Rostislav Kravchenko - avatar
1 Answer
+ 1
maybe it's because your global variable in that class isn't inicialized in its contructor (in fact, i don't see any constructor in it). If you're going to make an object of whatever class, you have to inicialize its variables in its respective constructor. (sorry for my english. I'm learning)
30th Sep 2018, 2:28 AM
Vardo
Vardo - avatar