Extract substring from end of a Java String Today I’ll show you how to extract last few characters (a substring) from a string in Java. Here is the code to do this.