Code: ... memoryTeams[] goldteammemory; ... if(cmd.getName().equalsIgnoreCase("cmd")){ goldteammemory = new memoryTeams[args.length]; for(int i=0;i<args.length;i++) { goldteammemory[i].team = new Team().gold;//Error in this goldteammemory[i].nickname = args[i];//and this lines. } return true; } Code: public class Team { Team gold; Team undef; } Code: public class memoryTeams { Team team = new Team().undef; String nickname; }
Well you never specified a real error, but one problem I see here is this... i<args.length, it should be i>args.length, because i will never be less than args.length, only equal to or greater than...
you'll not even get into the loop if you change it to yours. when you do a for loop through an array, the index must be smaller than the actual size of the array at any time. So it's totally correct there.