I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE COURSE

This article is part of a series:
• Java String.String()
• Java String.endsWith()
• Java String.codePointCount()
• Java String.codePointAt()
• Java String.concat()
• Java String.contains()
• Java String.copyValueOf()
• Java String.endsWith()
• Java String.format()
• Java String.getBytes()
• Java String.indexOf()
• Java String.intern()
• Java String.isEmpty()
• Java String.lastIndexOf()
• Java String.regionMatches()
• Java String.replace()
• Java String.replaceAll()
• Java String.split()
• Java String.startsWith()
• Java String.subSequence()
• Java String.substring()
• Java String.toLowerCase()
• Java String.toUpperCase()
• Java String.trim()
• Java String.valueOf()

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"));
}

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE LESSONS