Both extract a portion of a character sequence.
substring()returns a String, whilesubSequence()returns aCharSequence.
String text = "Hello World";
# 1. Returns a String
String sub1 = text.substring(0, 5); # "Hello"
System.out.println(sub1.toUpperCase()); # Works directly -> "HELLO"
# 2. Returns a CharSequence
CharSequence sub2 = text.subSequence(0, 5); // "Hello"
sub2.toUpperCase(); # Compile error! CharSequence does not have toUpperCase()
System.out.println(sub2.toString().toUpperCase()); # Works after converting -> "HELLO"