Latest web development tutorials

Java subSequence () method

Java String class Java String class


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

grammar

public CharSequence subSequence(int beginIndex, int endIndex)

parameter

  • beginIndex - the beginning index (including).

  • endIndex - the end index (not included).

return value

It returns a new character sequence that is a subsequence of this sequence.

Examples

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

    	 System.out.print("返回值 :" );
         System.out.println(Str.subSequence(4, 10) );
	}
}

The above program execution results:

返回值 :w3big

Java String class Java String class