Click here to watch in Youtube :https://www.youtube.com/watch?v=yH3dqWFZ5WI&list=UUhwKlOVR041tngjerWxVccwClick the below Image to Enlarge |
| Java Tutorial : Java StringBuilder [subSequence(int start, int end) method] |
 |
| Java Tutorial : Java StringBuilder [subSequence(int start, int end) method] |
 |
| Java Tutorial : Java StringBuilder [subSequence(int start, int end) method] |
SubSequenceDemo.java /*
* public CharSequence subSequence(int start, int end)
*
* Parameters:
* ----------
* start - the start index,inclusive.
*
* end - the end index, exclusive.
*
* Returns:
* -------
* the specified subsequence.
*
* Throws:
* ------
* IndexOutOfBoundsException - if start or end
* are negative, if end is greater than length(),
* or if start is greater than end.
*/
public class SubSequenceDemo
{
public static void main(String[] args)
{
StringBuilder sb = new StringBuilder("Welcome");
CharSequence charSequence = sb.subSequence(3, 6);
String strValue = (String) charSequence;
System.out.println("strValue = " + strValue);
}
}