1.System類
(1)成員方法
public static Long currentTimeMillis() //返回以毫秒爲單位的當前時間
public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int Length) //將數組中指定的數據拷貝到另一個數組中 src - 源數組 srcPos -源數組起始位置 dest - 目標數組 destPos - 目標數組起始位置 Length - 要複製的數組元素的個數
2.StringBuilder類
(1)構造方法
StringBulider(); //創建一個空的字符串緩衝區對象
StringBulider(String str); //根據傳入的內容創建一個字符串緩衝區對象
(2)成員方法
StringBuilder append(Object obj); //添加內容
StringBuilder reverse(); //反轉內容
String toString(); //將緩衝區內容轉換爲字符串
3.包裝類
(1)裝箱
構造方法
Integer(int value) //構造一個新分配的Integer對象,它表示指定的int值
Integer(String s) //構造一個新分配的Integer對象,它表示String參數所指的int值 如“100” 注意:“a”是不行的
靜態方法
static Integer valueOf(int value) //返回一個表示指定int值的Integer實例
static Integer ValueOf(String s) //返回保存指定的String的值的Integer對象
成員方法(拆箱)
int intValue() //以int類型返回該Integer的值
4.字符串與基本數據類型的轉換
(1)基本數據類型轉換爲字符串
a.基本類型數據與“”相連接即可
String s1=100+"";
String s2=28.02+"";
b.使用包裝類中的靜態方法
static String toString(int i) //返回一個指定整數的String對象
c.使用String類中的靜態方法
static String valueOf(int i) //返回int參數的字符串表示形式
(2)String類型轉換爲對應的基本類型:使用包裝類的靜態方法parseXX("字符串")方法
public static byte parseByte(String s) //將字符串轉換爲對應的byte基本類型
public static short parseShort(String s) //將字符串轉換爲對應的Short基本類型
public static int parseInt(String s) //將字符串轉換爲對應的int基本類型
public static long parseLong(String s) //將字符串轉換爲對應的long基本類型
public static float parseFloat(String s) //將字符串轉換爲對應的float基本類型
public static double parseDouble(String s) //將字符串轉換爲對應的double基本類型
public static boolean parseBoolean(String s) //將字符串轉換爲對應的boolean基本類型