How do you write a character array in Java?

How do you display a character array in Java?

String s = “aejou“;

  1. char[] arr = s. toCharArray();
  2. System. out. println(Arrays. toString(arr)); //line1.
  3. arr[2]=’i’;
  4. System. out. println(Arrays. toString(arr)); //line2.

How do you initialize a character array?

In C++, when you initialize character arrays, a trailing ‘

THIS IS IMPORTANT:  Is there Operator Overloading in Java?
Categories BD