Java Se basic series (notes), javase
The java. lang. String class represents an unchangeable character sequence.
Common methods for the String type: 1. public char charAt (int index); -- returns the character whose subscript is index.
2. public int length ();
3. public int indexOf (String str); -- returns the subscript of the String str that appears for the first time in the String.
4. public int indexOf (String str, int fromIndex );
5. public boolean using signorecase (String another); -- determines whether the two strings are equal regardless of Case sensitivity.
6. public boolean startWith (String prefix); the corresponding endWith
7. public String subString (int beginIndex); -- returns the subString from beginIndex.
8. public String trim (); -- removes the leading and trailing spaces of the String.
9. public static String valueOf (int num); -- converts the basic type to a String.
10. public String [] split (String regex); -- Splits a String according to the specified delimiter and returns the split String array.
The StringBuffer class represents a variable character sequence, which can be changed.
Common Methods: 1. public StringBuffer append (...); -- add to the end
2. public StringBuffer insert (...); -- insert
3. public StringBuffer delete (int start, int end );
4. public StringBuffer reverse (); -- used to reverse the string
Basic data type packaging
Int I = 100; // I is allocated to the stack.
Integer I = new Integer (100); // allocated to the stack at this time
Public int intValue (); -- returns the int value of the encapsulated data.
Public static int parseInt (String s); -- parses the String into int type data and returns the data.
Public static Integer valueOf (String s); -- returns an Integer object. The encapsulated Integer data is represented by String s.
Math class: provides a series of static methods. The parameter and return value types of the method are generally double.
Random () -- returns a random number between 0.0 and 1.0.
The Flie class indicates the System File Name (path and file name)
Common constructor: public File (String pathname) -- creates an object named pathname.
/Public File (String parent, String child)
Static attribute of File: String separator stores the path separator of the current system (Common Slash !!!)
Common Methods: -- access File attributes through File objects
1. public boolean canRead ()
2. public boolean canWrite ()
3. public boolean isDirectory ()
4. public boolean isFile ()
5. public String getName ()
6. public String getPath ()
-- Create an empty File or directory through the File object (if the File or directory referred to by this object does not exist)
1. public boolean createNexFile ()
2. public boolean mkdir () -- create a path
3. public boolean mkdirs () -- create a series of paths