java

// 字符串常量池
        String s1 = "java";
        String s2 = "疯狂";
        String s3 = "java疯狂";
        String s4 =s1+s2;
        String s5= new String("java疯狂");
        String s6 ="java"+"疯狂";
        System.out.println(s3==s4); //false;
        System.out.println(s3==s6); // true;
        // 缓存 
        Integer aInteger =2 ;
        Integer bInteger =2 ;
        Integer a1=128;
        
        Integer a2=128;
        System.out.println(aInteger==bInteger);// true;
        System.out.println(a1==a2); //false 

 

posted @ 2016-07-11 16:34  刀小爱  阅读(98)  评论(0编辑  收藏  举报