I'm trying to write some code in Java revolving around a Char Array and have some questions, starting with the 1st one below. If possible anywhere in the code, I prefer to use Java 8 and avoid using loops. Please help and thank you.
Question 1: Print out the max capacity for a character array.
// Create a character array that can hold a max of 10 elements and copy
over the contents from another character array.
char[] charArr1 = {'A','B','C'};
char[] charArr2 = new char[10];
charArr2 = charArr1.clone();
// I wanted the result below to be 10, but the output was 3.
System.out.println(charArr2.length);