im creating a random player match generator and im experimenting with java for its implementation I am getting this "<identifier> expected" error" and I really cannot figure out how to make it go away!

here is the code. The implemenation of main() is not completed yet so just ignore it for now.

where is it bolded is where the problem lies. i am sure this is a completely noob problem :/.

thanks in advance. :WAVE:

05-17-2006, 08:37 AM

Phaelax

I tried to compile it, but I'm using 1.4 so I had to remove the generics. I receive a different error, "non-static variable this cannot be referenced from a static context". It points at "playr" in the main method. I have no idea why, the main method should be able to instantiate the inner class. And I see no place where its using "this". This one has me stumped.

Ah, nevermind. It just hit me. (been a long night) Since Player is an inner class, it doesn't technically exist until wnrandom is instantiated.

wnrandom w = new wnrandom();
Player playr = w.new Player();

Change that and see if the other error doesn't go away.

05-17-2006, 05:34 PM

davo345

OK, well if I modify my code to make it so there are no inner classes within wnrandom (just move the bottom curly brace up), it gives me the same error.