JavaSE語法小知識彙總

2021-08-04 03:44:05 字數 2049 閱讀 4680

public class testvar3 

system.out.println(c);

double b = 3.14;

system.out.println(b);

float f = (int)3.3333333333f;

double main = 3.567567576576576576576678676767867867868768767687;

system.out.println(main);

system.out.println(f);

}}

輸出結果:32z

3.14

3.5675675765765766

3.0

public class testif11 else if(num3==221)

// // }

for (int i = 0; i < 5; i++)

/** + a.正數 +12 b.連線符 拼接 技巧: +左右兩端只要有乙個字串整體提公升為字串 連線 +左右兩端無字串 +算術運算子

* 加法運算

*/system.out.println("-----------------------------");

system.out.println(1 + 2 + 3 + "哈哈");// 6哈哈

system.out.println(1 + '2' + 3 + "哈哈");// 54哈哈

system.out.println('1' + '2' + '3' + "哈哈");// 150哈哈

system.out.println(1 + "2" + 3 + "哈哈");// 123哈哈

system.out.println("哈哈" + 1 + 2 + 3);// 哈哈123

system.out.println("哈哈" + 1 + '2' + 3);// 哈哈123

system.out.println("哈哈" + "1" + "2" + 3);// 哈哈123

system.out.println("--------------------");

system.out.println(1 + 2 + 3 + 4 + 5 + "haha");

system.out.println('1' + 0 + 1 + 2 + "" + 3 + 4);

}}

輸出結果:

8d1b

9j6e

9t3i

8g4z

9t3i

-----------------------------

6哈哈54哈哈

150哈哈

123哈哈

哈哈123

哈哈123

哈哈123

--------------------

15haha

5234

public class testoper0 

}

輸出結果:015

15136

24

public class testopel 

}

輸出結果:

i:2j:7

k:4h:3

p1:1

p2:1

q1:1

q2:0

public class testoper5 

}

true

false

false

false

true

true

true

false

false

true

true

false

true

false

false

false

true

true

true

false

system.out.println(false&&true);//fasle   後邊的true不會執行,自動短路

《C語言語法知識》 小知識點彙總

在使用 關係運算子時,為了避免會誤寫為賦值符號 而無法被檢測出錯誤,將值放在運算子左側,變數放在運算子右側,如if y value 這樣當誤寫時編譯器就會報錯。do while迴圈先執行迴圈體中的內容,然後判斷while後表示式的值,若為真,再次執行迴圈體,若為假,則跳出迴圈。注意 do while...

前端小知識彙總

disabled 超文字傳輸協議 http 的設計目的是保證客戶機與伺服器之間的通訊。http 的工作方式是客戶機與伺服器之間的請求 應答協議。web 瀏覽器可能是客戶端,而計算機上的網路應用程式也可能作為伺服器端。head 與 get 相同,但只返回 http 報頭,不返回文件主體 put 上傳指...

python語法小知識

1,關鍵字傳參 coding utf 8 def f a,b,c 3,d 4 print a,b,c,d print f 1,2,c 5,d 6 print f 1,2,d 5,c 6 print f a 3,b 4 print f b 4,a 3 print f d 4,c 3,b 2,a 1 p...