how to copy array in java

49

clone array in java -

		int a[] = { 1, 8, 3 };
        // Copying elements of a[] to b[]
        int b[] = a.clone()

clone array in java -

public static int[] copyOf​(int[] original, int newLength)

clone array in java -

public static void arraycopy(Object src, int srcPos, Object dest, 
                             int destPos, int length)

Comments

Submit
0 Comments