回覆列表
  • 1 # 潘德比島

    1、右擊專案的包new--->Class,如圖所示:

    3、在Demo類中編寫運算子程式碼,

    int a = 10;

    int b = 20;

    int c = 25;

    int d = 25;

    System.out.println("a + b = " + (a + b) );

    System.out.println("a - b = " + (a - b) );

    System.out.println("a * b = " + (a * b) );

    System.out.println("b / a = " + (b / a) );

    System.out.println("b % a = " + (b % a) );

    System.out.println("c % a = " + (c % a) );

    System.out.println("a++ = " + (a++) );

    System.out.println("a-- = " + (a--) );

    //檢視 d++與++d的不同

    System.out.println("d++ = " + (d++) );

    System.out.println("++d = " + (++d) );

    5、可以在控制檯檢視輸出,如圖所示:

    注意檢視++d和d++的區別。

  • 中秋節和大豐收的關聯?
  • 寶寶晚上睡覺經常自言自語,是在做夢嗎?