char 一個字節 8位
(1 byte = 8)
int 2 byte = 16
long 4 byte = 32
String 單個字符
public static void isit() {
char c = '編';
String str = "編";
System.out.println(str.getBytes().length);//2 說明單個字符佔了2個字節
}
基本類型short 、boolean
char 一個字節 8位
(1 byte = 8)
int 2 byte = 16
long 4 byte = 32
String 單個字符
public static void isit() {
char c = '編';
String str = "編";
System.out.println(str.getBytes().length);//2 說明單個字符佔了2個字節
}
基本類型short 、boolean
正確方法 Iterator<Integer> it =list.iterator(); while(it.hasNext){ it.move } 錯誤方法 for(Integer i:list){