JAVA-基本

在這章主要介紹java中的基本輸出,system.out.println().

以上為java原碼


class HELLo {            //HELLo為類別名,必須以檔安名相同

    public static void main(String[] args) {
        System.out.println("hello world!");         //這里是要顯示出 hello world! 字串
    int a = 0;
        System.out.println("a的值"+a);
    char A = '字';            //宣告字元 A,值只能為一個字
        System.out.println(A);
    String s = "字串宣告";    //字串宣告,值需娭""括住
        System.out.println(s);
       
    String fruit = a+A+s+"<---這就是捙接";
            System.out.println(fruit);             //變數的捙接需要用+
       
    }
}



輸出結如下


hello world!
a的值0

字串宣告
23383字串宣告<---這就是捙接


留言

這個網誌中的熱門文章

VMware Workstation 教學之三種網絡設定模式

SET命令詳解

分頁檔的設定