心得
寫程式時,在旁邊加上註解能提高自己與其他人閱讀效率,尤其在企業做交接工作時,能輕易讓同事快速了解自己寫的程式。
Java迴圈,字串String
/*游昕樺2022/10/17,w3shools學習,for迴圈loop*/
public class Main {
public static void main(String[] args) {
int i, j, k=10; /*宣告整數integer i,j,k*/
String a="第", b="列:"; /*宣告字串a,b且設定初值="放屁"*/
a ="第";
for ( i = 10; i > 0; i--) {/*迴圈一次增加1, i=i+1可用i++執行*/
System.out.print(a+i+b); /*系統System的.out輸出.println列印,line列*/
for ( j = 0; j <= i; j++)/*迴圈內僅有一指令,可以不用{....}*/
System.out.print(j); /*系統System的.out輸出.print列印*/
System.out.println(); /*純粹換line換列*/
}
}
}
挪威w3schools學習Java(甲骨文Oracle公司維護)截圖
Java試探統一碼UNICODE
/* 游昕樺2022/10/17,w3shools學習,for迴圈loop */
public class Main {
public static void main(String[] args) {
int i, j, k=10; /*宣告整數integer i,j,k*/
String a="第", b="列:"; /*宣告字串a,b且設定初值="第"*/
a ="第";
for ( i = 10; i > 0; i--) {/*迴圈一次增加1, i=i+1可用i++執行*/
System.out.print(a+i+b); /*系統System的.out輸出.println列印,line列*/
for ( j = 0; j <= i; j++)/*迴圈內僅有一指令,可以不用{....}*/
System.out.print(j); /*系統System的.out輸出.print列印*/
System.out.println(); /*純粹換line換列*/
}
for ( i =40845; i < 40851; i ++){/*試探統一碼unicode 40845的對應字元*/
a = Character.toString(i); /*Character字元.的toString轉成字串*/
System.out.println( i + " 字碼的字元是 " + a ); }
System.out.println("統一碼unicode涵蓋地球上所有文字,當然涵蓋傳統的ascii美國標準資訊交換碼");
for ( i =48; i < 122; i ++){/*試探ascii的對應字元,American Standard Code for Information Exchange*/
a = Character.toString(i); /*Character字元.的toString轉成字串*/
System.out.println(i + "碼的字元" + a ); }
}
}
w3schools截圖Java試探統一碼UNICODE
變數型態
型態 | 位元數 | 範圍 |
位元數byte | 1位元組8位元 | -128到127共256個2^8 |
短整數short | 2位元組16位元 | -32768到32767共2^16 |
整數int | 4位元組32位元 | -2147483648到2147483647共2^32 |
整數 long 64 -9223372036854775808 ~ 9223372036854775807
浮點數 float 32 依據 IEEE 754 標準
浮點數 double 64 依據 IEEE 754 標準
布林值 boolean 1 true, flase
字元 char 16 '\u0000' - '\uffff'
留言
張貼留言