That's been discussed here in this thread:
aa.add(bb); // store 2d int array in an arraylist
The print it part:
int[][] bbbb = add.get(0); // get 2d array from arraylist...
Type: Posts; User: Norm
That's been discussed here in this thread:
aa.add(bb); // store 2d int array in an arraylist
The print it part:
int[][] bbbb = add.get(0); // get 2d array from arraylist...
How you define the ArrayList depends on what you want to store in it.
What do you want to store in the arraylist?
How will you use what is stored in the arraylist?
Sorry I don't understand where you have to make any classes. The code in post#14 was just an example.
The code in post#12 should work.
Check your requirements. Making arrays of ArrayLists is...
The code is printing what the toString() method for a two dim int array returns.
You need to go back and read what I posted earlier.
The arraylist has ONE element: a two dim array of int.
aa.get(y).get(x)
Don't chain methods together. Use one statement for each method call so you know what data types you are working with.
SomeClass smcls = aa.get(x);
AnotherClass anCls =...
An int array does not have a get() method.
The ArrayList class's get() method returns an element from the arraylist. In this code that element is an int[][]
int[][] bbbb = aa.get(0);
You don't need the loops. Just add the array with one add statement.
what do want in the arraylist? The code will have one element that is a 2 dim int array.
There is no ArrayList array used...
Use int[][] vs Integer[][] to define the arraylist and then you can add bb to it.
Look at the API doc for the ArrayList class's add() method to see how to code it.
Depends what is in the array list. For custom formatting, use a loop, get each item from the arraylist and...
Do you get errors when you compile the posted code? If so, post them.
You said:
Please post what it does print when executed.
HINT: For testing use a small array. For example: 3x4 not...
Can you post how it currently prints
and add comments showing how you want it to print.