.contentEquals()
christian.dinh2476 total contributions
Published Jul 26, 2021Updated Sep 3, 2021
Contribute to Docs
Returns true
if the sequence of characters in the string is equal to the content of the specified string. If not, returns false
.
Syntax
string.contentEquals(CharSequence characters)
characters
(required): A character value specifies the sequence of characters to be searched for.
Example 1
Call the .contentEquals()
method on the word
string with the arguments "water"
and "watermelon"
:
class isContentEqual {public static void main(String[] args) {String word = "watermelon";System.out.println(word.contentEquals("water"));System.out.println(word.contentEquals("watermelon"));// Output: false// Output: true}}
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- robgmerrill124 total contributions
- christian.dinh
- Anonymous contributor
- robgmerrill
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.