Easy Tutorial
❮ Java Regular Expressions Data Queue ❯

Java subSequence() Method

Java String Class


The subSequence() method returns a new character sequence that is a subsequence of this sequence.

Syntax

public CharSequence subSequence(int beginIndex, int endIndex)

Parameters

Return Value

Returns a new character sequence that is a subsequence of this sequence.

Example

public class Test {
    public static void main(String args[]) {
         String Str = new String("www.tutorialpro.org");

         System.out.print("Return Value :" );
         System.out.println(Str.subSequence(4, 10) );
    }
}

The result of the above program is:

Return Value :tutorialpro

Java String Class

❮ Java Regular Expressions Data Queue ❯