java基礎ch1

 

1.java基本類型:int、short、long、byte、float、double、boolean、char
2.變量和常量,變量:public int i;public String str中i和str爲變量;public final int I=10;public final String STR="hello"

中I和STR爲常量。
3.如果想要遍歷一個字符串,並依次查看每一個代碼點:int cp = String.codePointAt(i);
4.String StirngBuffer StringBuilder
5.判斷二個字符串是否相同使用equals()方法,不需要區別大小寫使用equalsLgnoreCase()方法,字符串比較compareTo(String other);
判斷字符串是否以suffix結尾endsWith(String suffix)/startsWith(String

suffix);subString/replace/indexof/toUpperCase/toLowerCase/trim等方法

6.控制檯標準輸入流:Scanner in = new Scanner(System.in);in.nextLine();
7.塊的作用域{}但NEW實例執行
8.多重條件判斷和選擇時需要注意Switch(int)語句只能是int類型和enum類型。
9.break、continue、return,break跳出循環體;continue跳出本次循環;return跳出該方法體;
10.數字copey:System.arrayCopy(from,fromindex,to,toindex,count);

發佈了83 篇原創文章 · 獲贊 26 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章