单选题 请阅读下面程序   public class ExampleStringBuffer{   public static void main(String[]args){   StringBuffer sb=new StringBuffer("test");   System.OUt.println("buffer="+sb);   System.OUt.println("length="+sb.length   ());}}   程序运行结果中在"length="后输出的值是( )。
【正确答案】 B
【答案解析】【解析】本题对StringBuffer(String str)构造方法,用str给出字符串的初始值,并分配16个字符的缓存。因此,字符串sb的初始值是”test”,并且包含l6个字符的缓存。length()方法用来获得字符串长度,不包含缓存。故程序运行结果中在”length=”后输出的值应该是字符串sb的长度,即4。