class StringDemo{
public static void main(String args[]){
StringBuffer sbfSource=new StringBuffer("You are the best!");
char[] str=new char[5];
sbfSource.getChars(0,2,str,0);
System.out.println(str);
}
}
public static void main(String args[]){
StringBuffer sbfSource=new StringBuffer("You are the best!");
char[] str=new char[5];
sbfSource.getChars(0,2,str,0);
System.out.println(str);
}
}
char[]在访问前必须要被分配空间,
所以有char[] str=new char[5];