Thursday, 10 July 2014

subSequence (int start, int end)

public synchronized CharSequence subSequence(int start, int end)
Returns a new character sequence that is a subsequence of this sequence.

public class StringBufferSubSequence {
    public static void main(String args[]){
        StringBuffer s1 = new StringBuffer("Hello how are you");  
        System.out.println(s1.subSequence(6, 9));
    }
}

Output
how

1. Throws IndexOutOfBoundsException, if start or end are negative, if end is greater than length(), or if start is greater than end.


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment