Hi I'm trying to create an array of objects and then put a different value into each object. Problem is, I don't know why this isn't working.
public class TestProg2{
public static void main(String args[]){
Rank rank= new Rank();
}
}
class Rank{
private static int rankIndex=0;
public Rank(int enterRankIndex){ rankIndex=enterRankIndex; }
Rank [] ranks = new Rank [13];
for(i=0;i<ranks.length;i++) {
ranks[i]=new Rank(i);
System.out.println("create Rank marker:"+ranks[i]);
}
}
I keep getting these errors:
2 errors found:
File: /Volumes/LA-PUBLIC/TestProg2/TestProg2.java [line: 13]
Error: illegal start of type
File: /Volumes/LA-PUBLIC/TestProg2/TestProg2.java [line: 16]
Error: <identifier> expected