java面试题(自创)

1、最后输出的是啥?

        String s = "hello";
        final String str = s;
        s = "world";
        System.out.println("str = " + str);    

答案:hello,扩展,无论是否加final,都是hello

 

posted @ 2017-07-05 11:41  练好本领,报国杀敌  阅读(172)  评论(0编辑  收藏  举报