String a="hello";与String a=new String("hello");
它们之间有什么区别

解决方案 »

  1.   

    第一个创建了一个String对象。将引用给a
    第二个创建了两个String 对象,一个是"hello",另一个是new String(刚才那个hello对应的对象),并把引用给a
      

  2.   

    String a="hello"; 先在String池里面查找,没有再创建与String a=new String("hello");直接创建
      

  3.   

    interpb(曾曾胡) 说得有道理