Java String subSequence()

The syntax of the subSequence() method is:

string.subSequence(int startIndex, int endIndex)

Here, string is an object of the String class.


subSequence() Parameters

The subSequence() method takes two parameters.

  • startIndex - the starting index
  • endIndex - the ending index

subSequence() Return Value

  • The subSequence() method returns a CharSequence.

Example: Java String subSequence()