2d array
...... i just want to store 2d array in arraylist and print it. can you just post me the link where i can read about it?
thanks
Type: Posts; User: game06
2d array
...... i just want to store 2d array in arraylist and print it. can you just post me the link where i can read about it?
thanks
i am making a tile map. so 2d int array(bb) is the map. online when ever they make a tile map they seem to store in some kind of arraylist.
which do you think the best choose of what iam trying...
SomeClass smcls = aa.get(x);
AnotherClass anCls = smcls.get(y);
but with this i will have to make two more classes???
i am sure there is a way in java so i dont need to create classes. i just...
why is this printing the address. should it print the value? bc of aa.get(y). isnt that same as in array aa[y]. which prints a value?
so close just need to print the arraylist
code that i...
yes, i am not using array tho. i am using arraylist. variable aa is arraylist.
ex: there is no array here.
for(int y = 0; y < aa.size(); y++) {
for(int x = 0; x < aa.size(); x++){
...
like aa.add(bb); //thats why it was print so much data on output
and to print arraylist would you print like 2d array?
1st add so two loops or you wont need the two loops
2nd print
...
so to store 2d array in 2d arraylist you have to do this below:
ArrayList<int[][]> aa= new ArrayList();
int bb[][] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
...
also can u tell me can i store 2d array in 2d arraylist? or there is no such thing as 2darraylist.
and which of below is right if i want to store 2d array in arraylist
1) ArrayList<Integer[][]>...
error:
line 18 is aa.add(x,y);
also change it to aa.add(bb.[x],bb.[y]); doesnt work.
------------------------------------------------------------------
also can u tell me can i store...
i want arraylist to print like 2d array.
also note <Integer[][]> give me error. so i added <Integer>
but out put is:
[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,...
how to save 2d array in arraylist and how to print it???
import java.util.ArrayList;
public class aaa {
public static void main(String[]args)
{
ArrayList<Integer[][]> aa= new...