If j[1] is an array of char
(the primitive, not the object Character
) then you cannot not call the equals method on it, just like you cannot call 1.equals("A")
.
So, this would work instead (using objects)
char[] array = new char[] { 'a', 'b', 'c' };
boolean equals = array[0].equals('a'); // Cannot invoke equals(char) on
// the primitive type char
Character.valueOf('a').equals(Character.valueOf(array[0])); //This works
Or this, using primitives:
char[] array = new char[] { 'a', 'b', 'c' };
boolean anotherEquals = array[0] == 'a'; // This works