Exception classes of type String and Method

异常类
throwable:{ error:IOError,linkageError,threadDeath,AWTError
{ Exception:SQLExpection,RuntimeExteption:(IndexOutOfBoundsException,NullPointerException,ArithmetchException),
IOException:FileNotFoundException,EOFEException

java exception handling mechanism provided in two ways:
using a try ... catch catch the exception: an exception will likely try to isolate the code in the statement, if an exception is encountered, the program stops executing code in the try block, jump to catch processing block
using statement throws an exception is thrown: the current method does not know how to handle exceptions that occur, the exception should be handled by a higher caller can use when defining the method throws an exception is thrown declare
all exceptions objects It contains the following common methods for accessing exception information:
the getMessage () method: returns the exception detailed description string;
printStackTrace () method: this exception stack trace output error information to the standard output;
printStackTrace (PrintStream S) method : the exception stack trace output to the specified output stream;
getStrackTrace (): returns the class of the exception stack trace is.

set list:
the ArrayList the ArrayList = new new
List.add () additive element
list.remove () can delete position, it can also be an element added
list.set ( , ) was added by location
List.get () to find
the traverse method:
for (int I = 0; I <list.size; I ++) {
System.out.println ();
}

Iterater it=list.iterator()
while(it.hasNext()){
int a=(Integer)it.next();
System.out.println(a);
}

length (); return string length
charAt (); char Returns the specified index value
charAt (int index) is a method that can be used to retrieve the character at a particular index
getChars (); the discharge from a character copied to somewhere somewhere
the getBytes (); return a byte array, return code value Ascii
the equals (); comparison values are identical
the compareTo (); Comparative character size
compareToIgnoreCase (); case-insensitive
Starts (ends) with (); if in certain characters beginning / end of
the IndexOf (); to the position of a character string appearing in
the LastIndexOf (); the same character position of the last occurrence of
the toUpperCase (); string uppercase turn
toLastCase (); small letter string
trim ( ); remove spaces inclusive of
split (); split
subString ( , ); taken, first starting position in parentheses, followed by an end position, showing the section taken as only one value, it is taken from the x place beginning to the end .
toCharArray (); string converted into character array
the Contains (); determining whether the statement string substring

In java, often use the "+" operator link, but the string is connected is different in different circumstances

StringBuffer () ;: character buffer is a thread-safe variable sequence of characters
the StringBuffer (); configured without a character buffer, an initial capacity of 16 characters
the append (); the other values are appended to the end
char the charAt ()
reverse () string inverted, backwards output

StringBufferBuilder (); with StringBuffer (); similar, but not thread safe

Guess you like

Origin blog.51cto.com/14589602/2459120