廖家慧JAVA資料型態

挪威3school.com練習java code

/*廖家慧2022/10/24Java變數variable資料type型態*/
public class Main {
  public static void main(String[] args) {
    int i;                    /*註解java, JavaScript, CSS*/
    int myNum = 5;            //宣告整數integer(whole number)
    float myFloatNum = 5.99f; //宣告浮點數floating point number, 4 bytes=32 bits,4位元組
    char myLetter = '龍';     //宣告字元character, 2 bytes=16 bits,2位元組
    boolean myBool = true;    //宣告布林boolean, 1 bit,1位元
    String myText = "winnie";  //宣告字串String
    i = myLetter;             //整數i=字元'龍'
    System.out.println(myLetter + "字碼unicode 10進位" + i);
    System.out.println(myNum);
    System.out.println(myFloatNum);
    System.out.println(myLetter);
    System.out.println(myBool);
    System.out.println(myText);
  }
}

挪威w3schools.com練習Java code截圖

Java原型primitive 資料型態,撰寫模式貼上

資料型態長度(位元組)範圍最小範圍最大
位元數1位元組=8位元-128127
短整數2位元組=16位元-32,76832,767
整數4位元組=32位元-2,147,483,6482,147,483,647
長整數8位元組=64位元-9,223,372,036,854,780,0009,223,372,036,854,780,000
浮點數4位元組=32位元1.4*10^-453.4*10^38
倍精數8位元組=64位元4.9*10^-3243.4*10^308
布林1位元falsetrue
字元2位元組=16位元'\u0000''\uffff'

資料型態長度(位元組)記憶體
位元數byte1位元組=8位元bbbbbbbb
短整數short2位元組=16位元bbbbbbbb.bbbbbbbb
整數4位元組=32位元bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
長整數8位元組=64位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
浮點數4位元組=32位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
倍精數8位元組=64位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
布林1位元/td>b
字元2位元組=16位元/td>bbbbbbbb.bbbbbbbb

Java原型primitive 資料型態,html模式貼上原始碼

資料型態長度(位元組)範圍最小範圍最大
位元數1位元組=8位元-128127
短整數2位元組=16位元-32,76832,767
整數4位元組=32位元-2,147,483,6482,147,483,647
長整數8位元組=64位元-9,223,372,036,854,780,0009,223,372,036,854,780,000
浮點數4位元組=32位元1.4*10^-453.4*10^38
倍精數8位元組=64位元4.9*10^-3243.4*10^308
布林1位元falsetrue
字元2位元組=16位元'\u0000''\uffff'

資料型態長度(位元組)記憶體
位元數byte1位元組=8位元bbbbbbbb
短整數short2位元組=16位元bbbbbbbb.bbbbbbbb
整數 4位元組=32位元bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
長整數8位元組=64位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
浮點數4位元組=32位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
倍精數8位元組=64位元/td>bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb
布林1位元/td>b
字元2位元組=16位元/td>bbbbbbbb.bbbbbbbb

留言

這個網誌中的熱門文章

2024年第二次期貨商業務員測驗「期貨交易法規」

衍生性商品風險管理

廖家慧tkinter視窗套件Entry工具代替OptionMenu工具