异常:如果 start 或 end 为负数,如果 end 大于 length(),或者如果 start 大于 end 则抛出 IndexOutOfBoundsException。下面的程序说明了 java.lang.StringBuffer.subSequence() 方法:示例 1:Java实现// Java program to demonstrate // the subSequence() Method. class GFG { public static void main(String[]...
示例2:对于 IndexOutOfBoundsException // Java program to demonstrate // subSequence() method import java.nio.*; import java.util.*; import java.io.IOException; public class GFG { public static void main(String[] args) { try { // Declare and initialize the char array char[] cb = { '...
如果start或end為負,或者end大於length(),或者start大於end,則拋出IndexOutOfBoundsException。 以下程序說明了java.lang.StringBuilder.subSequence()方法: 示例1: // Java program to demonstrate// thesubSequence() Method.classGFG{publicstaticvoidmain(String[] args){// create a StringBuilder object// with ...
示例2:For indexout of bound 异常// Java program to demonstrate // subSequence() method import java.nio.*; import java.util.*; import java.io.IOException; public class GFG { public static void main(String[] args) { try { // Declare and initialize the char array char[] cb = { 'a'...