Character Classes
[abc] Simple character class
[a-zA-Z] Character class with ranges
[^abc] Negated character class
NOTE: Incomplete ranges will be interpreted as "starts from zero" or "ends with last character".
I.e. [-a] is the same as [\\u0000-a], and [a-] is the same as [a-\\uFFFF], [-] means "all characters".
Standard POSIX Character Classes
[:alnum:] Alphanumeric characters.
[:alpha:] &nb ......
java exception ½â¾ö·½°¸ - ÎÒµÄÒì³£Íø|Òì³£|exception 791 - java.lang.NoSuchMethodError 792 - RuntimeException 793 - org.hibernate.exception.SQLGrammarException 794 - Internal Error 795 - ×Ô¶¨ÒåÒì³£ 796 - org.dom4j.DocumentException 797 - java.net.SocketException 798 - Exception¶ÔÏó 799 - SQLException 800 - Association references unmapped class 801 - web.xml 803 - ExceptionInInitializerError 804 - net.sf.hibernate.PropertyAccessException 805 - java.lang.NumberFormatException:For input string 807 - javax.servlet.ServletException 808 - org.hibernate.exception.GenericJDBCException: could not load an entity: 809 - JDBCExceptionReporter 810 - sqlexception ......
java exception ½â¾ö·½°¸ - ÎÒµÄÒì³£Íø|Òì³£|exception 791 - java.lang.NoSuchMethodError 792 - RuntimeException 793 - org.hibernate.exception.SQLGrammarException 794 - Internal Error 795 - ×Ô¶¨ÒåÒì³£ 796 - org.dom4j.DocumentException 797 - java.net.SocketException 798 - Exception¶ÔÏó 799 - SQLException 800 - Association references unmapped class 801 - web.xml 803 - ExceptionInInitializerError 804 - net.sf.hibernate.PropertyAccessException 805 - java.lang.NumberFormatException:For input string 807 - javax.servlet.ServletException 808 - org.hibernate.exception.GenericJDBCException: could not load an entity: 809 - JDBCExceptionReporter 810 - sqlexception ......
ʹÓÃjar°ü:
commons-pool-1.5.3.jar,tomcat-naming-common.jar,commons-pool-1.5.3-bin.zip,commons-dbcp.jar
×¢Òâ:jdbc Çý¶¯ÒªÓëÊý¾Ý¿â¼æÈÝ.
package test.comm;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
public class DBConnector {
static private InitialContext ic = null;
static private DataSource ds = null;
static private void initContext(){
try {
BasicDataSource bds = new BasicDataSource();
bds.setUrl("jdbc:oracle:thin:@localhost:1521:test");
bds.setDriverClassName("oracle.jdbc.OracleDriver");
bds.setUsername("test");
bds.setPassword("a");
Hashtable<String, String> evn = new Hashtable<String,String>();
evn.put("java.naming.factory.initial","org.apache.naming.java.javaURLContextFactory");
ic = new InitialC ......
ÔÚ½øÈëÎÒÃǽñÌìµÄ»°Ìâǰ£¬ÏÈÀ´¿´¿´ÏÂÃæÕâ¶Î´úÂ룬ÄãÖªµÀËüµÄ½á¹ûÂð£¿
³ÌÐò´úÂë
public class StringTest1{
public static void main(String[] args) {
String str1 = "abc";
String str2 = "abc";
System.out.println(str1 == str2);
}
}
¡¡¡¡ ÕýÈ·´ð°¸Ó¦¸ÃÊÇtrue¡£ÔÙÀ´¿´ÏÂÃæÕâ¶Î´úÂ룺
³ÌÐò´úÂë
public class StringTest2 {
public static void main(String[] args) {
String str1 = new String("abc");
String str2 = new String("abc");
System.out.println(str1 == str2);
}
}
¡¡¡¡ ÕýÈ·´ð°¸ÊÇfalse¡£
¡¡¡¡ ÖÚËùÖÜÖª£¬javaµÄStringÊDz»¿É¸Ä±äµÄ×Ö·û´®¶ÔÏó¡£ÎªÁËÌá¸ßЧÂÊ£¬javaΪStringÀàÌṩÁË´®³Ø¡£ÕýÈç´ó¼ÒËù¿´µ½µÄÄÇÑù£¬ÔÚStringTest1ÖоÍʹÓÃÁË´®³Ø¡£µ±ÄãÖØÐÂÉùÃ÷Ò»¸öStringÐͱäÁ¿Îªabcʱ£¬½«Ê¹Óô®³ØÀïÔÀ´µÄÄǸöabc£¬¶ø²»ÖØÐ·ÖÅäÄڴ棬Ҳ¾ÍÊÇ˵£¬str2Óëstr1½«»áÖ¸ÏòÍ ......
Java×Ö·û´®Àà(java.lang.String)ÊÇJavaÖÐʹÓÃ×î¶àµÄÀ࣬ҲÊÇ×îÎªÌØÊâµÄÒ»¸öÀ࣬ºÜ¶àʱºò£¬ÎÒÃǶÔËü¼ÈÊìϤÓÖİÉú¡£
Ò»¡¢´Ó¸ù±¾ÉÏÈÏʶjava.lang.StringÀàºÍString³Ø
Ê×ÏÈ£¬ÎÒ½¨ÒéÏÈ¿´¿´StringÀàµÄÔ´ÂëʵÏÖ£¬ÕâÊÇ´Ó±¾ÖÊÉÏÈÏʶStringÀàµÄ¸ù±¾³ö·¢µã¡£´ÓÖпÉÒÔ¿´µ½£º
1¡¢StringÀàÊÇfinalµÄ£¬²»¿É±»¼Ì³Ð¡£public final class String¡£
2¡¢StringÀàÊǵı¾ÖÊÊÇ×Ö·ûÊý×échar[], ²¢ÇÒÆäÖµ²»¿É¸Ä±ä¡£private final char value[];
È»ºó´ò¿ªStringÀàµÄAPIÎĵµ£¬¿ÉÒÔ·¢ÏÖ£º
3¡¢StringÀà¶ÔÏóÓиöÌØÊâµÄ´´½¨µÄ·½Ê½£¬¾ÍÊÇÖ±½ÓÖ¸¶¨±ÈÈçString x = "abc"£¬"abc"¾Í±íʾһ¸ö×Ö·û´®¶ÔÏó¡£¶øxÊÇ"abc"¶ÔÏóµÄµØÖ·£¬Ò²½Ð
×ö"abc"¶ÔÏóµÄÒýÓá£
4¡¢String¶ÔÏó¿ÉÒÔͨ¹ý“+”´®Áª¡£´®Áªºó»áÉú³ÉеÄ×Ö·û´®¡£Ò²¿ÉÒÔͨ¹ýconcat()À´´®Áª£¬Õâ¸öºóÃæ»á½²Êö¡£
6¡¢JavaÔËÐÐʱ»áά»¤Ò»¸öString Pool£¨String³Ø£©£¬JavaDoc·ÒëºÜÄ£ºý“×Ö·û´®»º³åÇø”¡£String³ØÓÃÀ´´æ·ÅÔËÐÐʱÖвúÉúµÄ¸÷ÖÖ×Ö·û´®£¬
²¢ÇÒ³ØÖеÄ×Ö·û´®µÄÄÚÈݲ»Öظ´¡£¶øÒ»°ã¶ÔÏó²»´æÔÚÕâ¸ö»º³å³Ø£¬²¢ÇÒ´´½¨µÄ¶ÔÏó½ö½ö´æÔÚÓÚ·½·¨µÄ¶ÑÕ»Çø¡£
5¡¢´´½¨×Ö·û´®µÄ·½Ê½ºÜ¶à£¬¹éÄÉÆðÀ´ÓÐÈýÀࣺ
ÆäÒ»£¬Ê¹Ó ......