Java Reference
In-Depth Information
from a database using
// a loop...but for this example we will manually
enter the player data.
playerList = new ArrayList();
playerList.add(constructPlayer("Josh", "Juneau",
"Right Wing", ACTIVE));
playerList.add(constructPlayer("Joe", "Blow",
"Left Wing", ACTIVE));
playerList.add(constructPlayer("John", "Smith",
"Center", ACTIVE));
playerList.add(constructPlayer("Bob","Coder",
"Defense", ACTIVE));
playerList.add(constructPlayer("Jonathan",
"Gennick", "Goalie", ACTIVE));
}
public Player constructPlayer(String first, String
last, String position, int status){
Player player = new Player();
player.firstName = first;
player.lastName = last;
player.position = position;
player.status = status;
return player;
}
public List<Player> getPlayerList() {
return this.playerList;
}
public static void main(String[] args) {
TeamInner inner = new TeamInner();
System.out.println("Team Roster");
System.out.println("===========");
for(Player player:inner.getPlayerList()){
System.out.println(player.playerString());
}
Search WWH ::




Custom Search