Java String subSequence() method

tutorial and example
tutorial and example

This method returns a new character sequence i.e. subsequence of current sequence

Syntax:

Parameter:

beginIndex − begin index, inclusive.

endIndex − end index, exclusive.

 Return:  specified subsequnce

 Throws:

It throws IndexOutOfBoundsException if begin or end index is negative , if end is greater than length(), or if start is greater than end.

 Java String subSequence() Example 1

Output: 

Java String subSequence() Example 2

Output:

Java String subSequence() method Example 3

Output:

Java String subSequence() Example 4

Output: