The method endsWith() is a convenience method that checks if a String ends with another given String. If the argument is an empty String, then the method returns true.

Available Signatures

public boolean endsWith(String suffix)

Example

@Test
public void whenCallEndsWith_thenCorrect() {
    String s1 = "test";
    
    assertTrue(s1.endsWith("t"));
}
Next »
Java String.format()
« Previous
Java String.copyValueOf()
November Discount Launch 2022 – Bottom
We’re finally running a Black Friday launch. All Courses are 30% off until end-of-day today:

>> GET ACCESS NOW

Generic footer banner
Comments are closed on this article!