i made board class array 3 integers.
public class board { public int[] boardarray = new int [3]; public board (int[] b1) { for(int i=0;i<b1.length;i++) { boardarray[i] = b1[i]; } } }
i want print out boards added array list called losers, can print spot in memory. understand have run loop , call each individual piece of array up, not understand how access elements of array. here code use print:
for (board b : loser) { system.out.println( b.int[0] +"" + b.int[1]+"" + b.int[2]); }
all boards added array list called losers
for (board b : loser) { system.out.println( b.boardarray[0] +"" + b.boardarray[1]+"" + b.boardarray[2]); }
since boardarray
type ofint
in board
class. int
datatype not variable. replace b.int[index]
b.boardarray[index]
.
Comments
Post a Comment