Create Copy Of Array From Another Array Code Example

Snippet 1

  int[] a = {1,2,3,4,5};
int[] b = Arrays.copyOf(a, a.length); 

Snippet 2

  int[] a = {1, 2, 3};      
int[] b = a.clone(); 

Copyright © Code Fetcher 2020

 

 

Published

Leave a comment

Your email address will not be published. Required fields are marked *