J2SE基礎學習 Day16

2021-08-19 19:57:24 字數 575 閱讀 7335

1.正規表示式

對字串的規則

\轉義字元  \t 製表符    \r 回車符  \n換行符     範圍    [^] 取反     .代表任何字元    /d相當於0-9    /w0-9a-z

[0-9]    1[34578][0-9]

2.string類中和正則相關的方法

matches    split使用規則對字串進行切割,返回乙個字串陣列

3.date類

date類構造方法

dateformat類方法parse,將字串轉成日期物件

4.celender類    

抽象類靜態方法getinstance()直接返回子類

get方法,獲取日曆欄位的值,int get(int)引數int獲取哪個日曆字段,返回值,表示日曆字段具體數值

set方法,設定日曆,set(int field,int value)field表示字段,value表示具體的值

set(int year,int month,int day)

add方法,日曆的偏移量,指定日曆中的字段進行整數偏移。add(int field,int value)

馬士兵J2SE 第二章 J2SE基礎語法 運算子

自加和自減運算子 在前時先運算再取值,在後時先取值再運算 public class test 輸出 i 20 i2 21 i 22 i2 22 i 9 i1 9 i 9 i2 8 邏輯運算子 public class test 輸出 false false true true false true ...

J2SE 物件導向

public static void main string args throws exception 資料型別 容量從小到大基本型別 byte short char int long float double boolean不能相互轉換 容量小的自動轉換為大的 容量大的轉換為小的時需加上強制轉換...

執行緒 建立 J2SE

建立執行緒的兩種方法 第一種,定義執行緒,實現 runnable介面 public class testthread1 class runner1 implements runnable start runner1和main thread交替執行。run runner1先執行,main thread...