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.
the error is:Code:import java.util.*; import java.lang.*; import java.awt.*; import java.io.*; public class wnrandom { public static void main (String[] args) { Player playr = new Player(); } public class Player { private String name; public void SetName(String pName) { name = pName; } public String GetName() { return name; } } public class Match { private ArrayList<Player> match = new ArrayList<Player>(); public void SetMatch(Player p1, Player p2) { match.add(p1); match.add(p2); } public void PrintMatch() { System.out.println( (match.get(0)).GetName() + " vs " + (match.get(1)).GetName() ); } } }
The ^ is supposed to be where the < is in <Player>linux1[10]% javac wnrandom.java
wnrandom.java:39: <identifier> expected
private ArrayList<Player> match = new ArrayList<Player>();
^
1 error
where is it bolded is where the problem lies. i am sure this is a completely noob problem :/.
thanks in advance.![]()


Reply With Quote


Bookmarks