下面程序的运行结果是()
String str1 = "hello";String str2 = "he" + new String("llo");System.err.println(str1 == str2);
String str1 = "hello";
String str2 = "he" + new String("llo");
false
因为str2中的llo是新申请的内存块,而==判断的是对象的地址而非值,所以不一样。如果是String str2 = str1,那么就是true了。
来我收藏夹吃灰吧!
一棵具有n个结点的二叉树,若它有m个叶子结点,则该二叉树中度为1的结点个数是多少?
分析一下,小程序为什么不能分享朋友圈?
微信公众号中服务号和订阅号合二为一,你怎么看?
ArrayList和LinkedList的区别,以及各自是怎么实现扩容的?
来我收藏夹吃灰吧!