StringBuilder sb = new StringBuilder("Hello, World!"); String sub = sb.substring(7, 12); System.out.println(sub);
StringBuilder sb = new StringBuilder("Hello"); String sub = sb.substring(sb.length() - 3); System.out.println(sub);Output: "llo" This method belongs to the java.lang package library.