You are viewing a single comment's thread from:
RE: Coding challenge #2 We need to go deeper
The above code is not working out the way i thought it would. I am going to leave it though and see if I can get the issue figured out. it is in my if/else statements, I know that. just not sure what to do about it yet.
So, I have spent the last few hours redoing the code (I am still new to Programming) and basically had to change all of it.
Now I keep getting a null pointer exception, where just a bit ago, I wasn't. Right when the user needs to hit a number 1-4 to choose the genre of the movie.
Before this, it ran fine until I asked the user if they would like to enter another movie. That throws an exception about a missing element. I am putting the code up.
https://pastebin.com/w1qQY5aM
Please take a look and help me to understand what happened.
I put comments in the code regarding the issue.
Thank You,
Gene @btcworker
Hi @btcworker, the issue is that:
Is not initialized you have to do:
Additionally, I would create the class "Movie" in a separate file and call it from another file with the main class.
This is not only important for readability but will also help us to extend the program later on.
Keep on coding!
P.S: I had to remove the > and the < tags because steemit doesn't like them =)
Besides that your variables in the movie should not be static
Thanks for the help on it. The only reason I didn't create it in a separate file/class was because i thought it was supposed to be one file.
I also already posted my solution in the next challenge or if you need any more help, just ask =)