GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — StringBuffer subSequence() in Java with Examples - GeeksforGeeks StringBuffer subSequence() in Java with ExamplesLast Updated : 17 Feb, 2022 The subSequence(int start, int end) method of StringBuffer class is the inbuilt method used to return a subsequence of characters lie between index start and end-1 of this sequence. The subsequence starts with the char value at the index start and ends with the char value at (end-1). The length of the returned subsequence is end-start. So if start is equal to end then an empty subsequence is returned. public CharSequence subSequence?(int start, int end)
Output: String length = 12 and contains = WelcomeGeeks SubSequence = Welcome
Output: String contains = Indian Team Played Well SubSequence = Team Played
Output: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuffer.substring(AbstractStringBuffer.java:935)
at java.lang.StringBuffer.substring(StringBuffer.java:76)
at java.lang.AbstractStringBuffer.subSequence(AbstractStringBuffer.java:912)
at java.lang.StringBuffer.subSequence(StringBuffer.java:76)
at GFG.main(File.java:16)
Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |