Character.equals() method in Java with examples
The java.lang.Character.equals() is a function in Java which compares this object against the specified object. If the argument is not null then the result is true and is a Character object that represents the same char value as this object.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public boolean equals(Object obj)
Parameters: The function accepts a single parameter obj which specifies the object to be compared with.
Return Value: The function returns a boolean value. It returns true if the objects are same, otherwise, it returns false.
Below programs illustrates the above method:
Z and Z are equal is true
a and A are equal is false