String. subSequence() is a built-in meaning in Java that revisits a CharSequence. CharSequence that is a follows of this sequence. The subsequence begins with the char value at the specified index and ends with the char value at (end-1).
Here is the syntax of this method:
public CharSequence subSequence(int beginIndex, int endIndex)
Here is the detail of parameters:
import java.io.*; public class Test { public static void main(String args[]) { String Str = new String("Welcome to Intellinuts.com"); System.out.print("Return Value :" ); System.out.println(Str.subSequence(0, 10) ); System.out.print("Return Value :" ); System.out.println(Str.subSequence(10, 12) ); } }
This will produce the following result:
Return Value :Welcome to Return Value : Inte
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.