StringBuffer类是不是字符串?
int[] a=int []{1,2,3,4,5};
int[] a={1,2,3,4,5}
//有什么区别?
String s1=new String("Hello World!");
String s2=new String("Hello World!");
//创建了几个String类的实例,都在哪?

解决方案 »

  1.   

    http://topic.csdn.net/u/20120607/07/9d3a5948-ca38-4eb9-a4f8-63400b34e13a.html
      

  2.   

    1:int[] a=int []{1,2,3,4,5};
    这种定义 编译能通过吗?
    再怎么也是 int [] b=new int[]{1,2,3};吧2:new 出来的对象必然都是在堆上public class StringTest { /**
     * @param args
     */
    public static void main(String[] args) {
    String s1= new String("hellow wrold");
    String s2=new String ("hellow wrold");
    System.out.println(s1==s2);
    System.out.println(s1.equals(s2));

    String s3="hellow wrold";
    String s4="hellow wrold";
    System.out.println(s3==s4);
    System.out.println(s3.equals(s4));

    }}false
    true
    true
    true
      

  3.   

    StringBuffer是一个类,是用char数组存字符串的。
    写法有区别,功能都一样。
    1个,字符串池
      

  4.   

    int[] a=int []{1,2,3,4,5};
    int[] a={1,2,3,4,5}
    //这两行代码有什么区别?
      

  5.   

    StringBuffer是一个类,是用char数组存字符串的。
    写法有区别,功能都一样。为了程序员少敲键盘用的.
    2个,Heap中(注意如果是 S="string", 是在字符串池,和new的区别就在于此)
      

  6.   

    问题1  StringBuffer类是不是字符串?
    StringBuffer是个字符串缓冲。可以加快程序的运行速度 这个是线程安全的 ,非线程安全的用StringBuilder问题2 int[] a=int []{1,2,3,4,5};
    int[] a={1,2,3,4,5}
    //有什么区别?
    没用区别  下面的这个是简略学法 建议用上面的那个问题3  String s1=new String("Hello World!");
    String s2=new String("Hello World!");
    //创建了几个St……创建了2个 记住 new了之后一定会在堆区创建一个新的对象