import java.util.Arrays; public class Comp2CharArray { public static void main(String[] args) { char[] c1 = new char[] { 'a', 'b', 'c', 'd' }; char[] c2 = new char[] { 'a', 'b', 'c', 'e' }; System.out.println(Arrays.equals(c1, c2)); char[] a1 = new char[] { 'a', 'b', 'c', 'd' }; char[] a2 = new char[] { 'a', 'b', 'c', 'd' }; System.out.println(Arrays.equals(a1, a2)); } }