1. String class: Immutable sequence of characters (e.g., string str = "Atguigu"; STR + + "java ee")
1. Focus on the usual methods of string!
2.String classes and basic data types, wrapper classes, and character arrays, byte arrays;
* 1. Conversion between string and base data type, wrapper class
*① String---> Basic data type, wrapper class: Parsexxx (String str) that invokes the corresponding wrapper class;
*① Basic data types, wrapper classes---> Strings: Overloaded valueof () methods that call strings
*
* 2. Conversion between a string and a byte array
*① string----> byte array: GetBytes () of the calling string
*② byte array----> string: constructor that invokes a string
*
* 3. Conversion between a string and a character array
*① String----> Character array: ToCharArray () that invokes the string;
*② Character array----> string: constructor that invokes a string
conversion of 4.String to StringBuffer
①string--->stringbuffer: constructor with StringBuffer: New StringBuffer (String str);
②stringbuffer----->string: Using the ToString () method of StringBuffer
StringBuffer class: Variable sequence of characters
StringBuilder class: Variable sequence of characters, jdk5.0 new, more efficient, thread insecure.
Common methods: Add: Append (...) remove delete (int startIndex, int endIndex) Modify: Setcharat (int n, char ch) query: charAt (int index)
insert: Insert (int index, String str) reverse reverse () Length: Length ()
Note: The non-variability of the string class:
2. Time and date class:
2.1System class Currenttimemillis (): Returns a Long value for the current time. This long value starts from January 1, 1970 0:0 00 seconds to the current number of milliseconds.
This method is commonly used to calculate the time difference.
2.2 Date class: Java.util.Date
1. Date d = new Date ();//Returns the current time of Date:mon 15:17:01 CST
Date D1 = new Date (15231512541241L);//return parameter at which the Long value corresponds
//gettime (): Returns the Long value corresponding to the current date. ToString ()
2.3simpledateformat:java.text.simpledateformat
formatting: Date---> Text using the Format () method of SimpleDateFormat
parsing: Text---> Dates using SimpleDateFormat's Parse () method
//1. Formatting 1
SimpleDateFormat sdf = new SimpleDateFormat ();
String date = Sdf.format (new date ());
System.out.println (date);//14-5-12 pm 3:24
//2. Formatting 2
SimpleDateFormat sdf1 = new SimpleDateFormat ("EEE, D MMM yyyy HH:mm:ss Z");
date = Sdf1.format (new date ());
System.out.println (date);//Monday, 125 15:29:16 +0800
//3. Parsing:
Date date1 = sdf.parse ("14-5-12 pm 3:24");
System.out.println (date1);
date1 = Sdf1.parse ("Monday, 125-month 15:29:16 +0800");
//date1 = sdf1.parse ("14-5-12 pm 3:24");
System.out.println (date1);
2.4 Calendar: Calendars class
2.4.1 Get instance: Calendar c = calendar.getinstance ();
2.4.2 Get ()/set ()/add ()/date getTime ()/settime ()
3.Math class
4.BigInteger BigDecimal Class
Java Common Classes