Java String equals


The java string equals() method compares the two given strings based on the content of the string. If any character is not matched, it returns false. If all characters are matched, it returns true.

The String equals() method overrides the equals() method of Object class.


Signature

public boolean equals(Object anotherObject)



Parameter

anotherObject : another object i.e. compared with this string.


Returns

true if characters of both strings are equal otherwise false.


Overrides

equals() method of java Object class.


Java String equals() method example

Flash soon



Copyright 2017 Design& Development