String類的基本特色

String str1 = "hello"; String str2 = "hello"; System.out.println(str1 == str2); 輸出爲ture。 String str1 = "hello"; String str2 = new String("hello"); System.out.println(str1 == str2); 此時輸出的是false,緣由是此時比較
相關文章
相關標籤/搜索