I am new to ArrayList and trying to create an object with a object inside but with format of array, someone can help me please.
Here is the code if you can help me, thank you in advance.
The case 1 is for receiving the values by keyboard.
case 1:
System.out.print("Ingrese el nombre del jugador: ");
objPartido.getObjTeam1().getObjPlayer().setNombre(sc.nextLine());
jugadorBaby.add(objPartido.getObjTeam1().getArrPlayer()[1]);
sc.nextLine();
partidoBaby.add(objPartido);
break;
In the case 2 i need to show the variable Nombre of the object player that i enter by keyboard in case 1
case 2:
for(int i=0;i<partidoBaby.size();i++){
muestraPartido(objPartido);
} break;
I wanna know how to do "muestraPartido" show me the case 1 values.
muestraPartido(Partido objPartido):
public static void muestraPartido(Partido objPartido){
for(int i=0;i<jugadorBaby.size();i++){
String n= jugadorBaby.get(i).getNombre();
System.out.println(n); }
t.Partido
private Team objTeam1;
private Team objTeam2;
public Partido() {
objTeam1 = new Team();
objTeam2 = new Team();}
t.Team
private Player[] arrPlayer;
private Player objPlayer;
public Team() {
arrPlayer = new Player[6];
objPlayer= new Player(); }
public Team(Player[] arrPlayer) {
this.arrPlayer = arrPlayer; }