码迷,mamicode.com
首页 > 其他好文 > 详细

字符串动手动脑实践

时间:2015-10-25 19:21:41      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

1、运行以下代码,解释并总结:

 
public class StringEquals {

    
/**
     * @param args the command line arguments
     */
    
    public static void main(String[] args) {
        
        String s1=new String("Hello");
        
        String s2=new String("Hello");

        
        System.out.println(s1==s2);
        
        System.out.println(s1.equals(s2));

        
        String s3="Hello";
        
        String s4="Hello";

          
        System.out.println(s3==s4);
        
        System.out.println(s3.equals(s4));
        
    
    }


}

结果截图:
技术分享

 

字符串动手动脑实践

标签:

原文地址:http://www.cnblogs.com/lk0823/p/4909186.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!