Java program not passing parameters.

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
Strange problem here guys, when instantiating the challenges class the driver class doesn't appear to pass the first string to the constructor.
 
Last edited:
Looks like you're doing the assignment the wrong way round in this line:

Code:
game = this.game;

You're actually setting the value that is passed in in the constructor to the value in the member variable, which will inevitably be null.
 
"game = this.game;" there is your problem.

Should be "game = this.games"

If you give your parameters different names to your variables you wont make these mistakes:)

Oops a bit late
 
It's always the simple things that trip you up. I remember writing some HTML and wondering why none of my images would work, couldn't figure it out after spending ages looking at the code. The next day I noticed it immediately, I had written <img scr="..." /> rather than <img src="..." />
 
Back
Top Bottom