String a = new String(); "" null

来源:互联网 发布:淘宝苏泊尔电压力锅 编辑:程序博客网 时间:2024/05/19 03:44
package jiami;


public class TestJava {


public static void main(String[] args) {
// TODO Auto-generated method stub
String a = new String();  
        String b = "";  
        String c = null;  
        if(a.isEmpty())  
        {  
         System.out.println("String a = new String");  
        }  
        if(b.isEmpty())  
        {  
         System.out.println("String b = \"\"");  
        }  
        if(c==null)  
        {  
         System.out.println("String c =null");  
        }  
        if(null == a) {  
            System.out.println("String a =null");  
        }  
        if(a=="")  
        {  
         System.out.println("a = ''");  
        }  
        if(a==b)
        {
        System.out.println("a=b");  
        }
        if(a==c)
        {
        System.out.println("a=c");  
        }
        if(b==c)
        {
        System.out.println("b=c");  
        }
     
}


}
0 0
原创粉丝点击