Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { char[] arr1 = new char[] { 'j', 'a', 'v' }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with newlength as 5 char[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 'a'; arr2[4] = '2'; System.out.println(Arrays.toString(arr2)); } }