天天看點

java資料類型,String

1.基本類型

整型:byte(8位),short(16位),int(32位),long(64位)

字元型:char(16位)

浮點型:float(單精度,32位),double(雙精度,64位)

布爾型(boolean):true,false

2.引用類型

String:

==

基本類型比較數值,引用類型比較位址

直接雙引号的字元串預設放在字元串池中(重複利用)
new出來的字元串不在字元串池中
String str1="hello";
String str2="hello";
String str3=new String("hello");
String str4=new String("hello");
str1==str2(true)
str3==str4(false)
           
java資料類型,String