Results 1 to 1 of 1
Thread: How to clone an Array
-
How to clone an Array
Java Code:public class CloneArray { public static void main(String args[]) { int array1[] = { 1, 2, 3, 4, 5 }; int array2[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; System.out.println("Original size: " + array1.length); System.out.println("New size: " + cloneArray(array1).length); System.out.println("Original size: " + array2.length); System.out.println("New size: " + cloneArray(array2).length); } static int[] cloneArray(int original[]) { return (int[]) original.clone(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
An nslookup clone in Java
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:12 PM -
clone method
By javaplus in forum New To JavaReplies: 2Last Post: 01-30-2008, 09:47 AM -
clone method
By gapper in forum New To JavaReplies: 1Last Post: 01-20-2008, 08:46 AM -
clone problem
By feniger in forum New To JavaReplies: 13Last Post: 01-13-2008, 10:55 AM -
How to clone a JAXB object ?
By simon in forum Advanced JavaReplies: 1Last Post: 07-14-2007, 11:56 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks