方思涵.w3schools.java data type資料型態練習
資料型態練習 public class Main { public static void main(String[] args) { int myNum = 5; // integer (whole number) int i; float myFloatNum = 5.99f; // floating point number char myLetter = 'A'; // character boolean myBool = true; // boolean String myText = "練習"; // String i=myLetter; System.out.println(myNum); System.out.println(myFloatNum); System.out.println(myLetter); System.out.println(myBool); System.out.println(myText); System.out.println(myLetter+"字碼unicode 10進位"+i); } } 資料型態 長度(位元組) 範圍最小 範圍最大 位元數 1位元組=8位元 -128 127 短整數 2位元組=16位元 -32,768 32,767 整數 4位元組=32位元 -2,147,483,648 2,147,483,647 長整數 8位元組=64位元 -9,223,372,036,854,780,000 9,223,372,036,854,780,000 浮點數 4位元組=32位元 1.4*10^-45 3.4*10^38 倍精數 8位元組=64位元 4.9*10^-324 3.4*10^308 布林 1位元 false true 字元 2位元組=16位元 '\u0000' '\uffff' 資料型態 長度(位元組) 記憶體 位元數byte 1位元組=8位元 bbbbbbbb 短整數short 2位元組=16位元 ...