| 本帖最后由 林康春 于 2012-2-18 21:02 编辑 
 class  StringAPIDemo
 {
 public static void main(String[] args)
 {
 String str1="hello";
 char c[]=str1.toCharArray();
 for (int i=0;i<c.length ; i++)
 {
 System.out.print(c+"\t");
 }
 System.out.println("");
 String str2=new String(c);
 String str3=new String(c,0,3);
 System.out.println(str2);
 System.out.println(str3);
 
 }
 }
 输出运行结果:
 h       e       l       l     o
 hello
 hel
 
 疑问:String str3=new String(c,0,3);
 这是什么意思?
 |