|
Copying 1 java array to another? -
December 12th, 2007
I am pretty sure i have done the right thing in copying 1 java array to another. My code is:
import java.lang.Object;
public class Unit11Dem2
{
public static void main(String[] args)
{
int[] age = { 21, 31, 16 };
int[] copy = new int[age.length];
System.arraycopy(age, 0, copy , 0, age.length);
System.out.println(copy);
}
}
The problem is that my output is always [I@19821f
even if i add more variables in the age[] i get the same output.
I am sure the code is correct but obviously not. Can someone explain why i am getting this wierd output.
cheers
|