javaÖÐ ×î³£ÓõÄString µÄÓ÷¨
String : ×Ö·û´®ÀàÐÍ
Ò»¡¢¹¹Ô캯Êý
String(byte[ ] bytes)£ºÍ¨¹ýbyteÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(char[ ] value)£ºÍ¨¹ýcharÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(Sting original)£º¹¹ÔìÒ»¸öoriginalµÄ¸±±¾¡£¼´£º¿½±´Ò»¸öoriginal¡£
String(StringBuffer buffer)£ºÍ¨¹ýStringBufferÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
ÀýÈ磺
byte[] b = {'a','b','c','d','e','f','g','h','i','j'};
char[] c = {'0','1','2','3','4','5','6','7','8','9'};
String sb = new String(b); //abcdefghij
String sb_sub = new String(b,3,2); //de
String sc = new String(c); //0123456789
String sc_sub = new String(c,3,2); //34
String sb_copy = new String(sb); //abcdefghij
System.out.println("sb:"+sb);
System.out.println("sb_sub:"+sb_sub);
System.out.println("sc:"+sc);
System.out.println("sc_sub:"+sc_sub);
System.out.println("sb_copy:"+sb_copy);
Êä³ö½á¹û£ºsb:abcdefghij
sb_sub:de
sc:0123456789
sc_sub:34
sb_copy:abcdefghij
¶þ¡¢·½·¨£º
˵Ã÷£º¢Ù¡¢ËùÓз½·¨¾ùΪpublic¡£
¢Ú¡¢Êéд¸ñʽ£º [ÐÞÊηû] <·µ»ØÀàÐÍ><·½·¨Ãû([²ÎÊýÁбí])>
ÀýÈ磺static int parseInt(String s)
±íʾ´Ë·½·¨(parseInt)ΪÀà·½·¨(static),·µ»ØÀàÐÍΪ(int),·½·¨ËùÐèҪΪStringÀàÐÍ¡£
1. char charAt(int index) £ºÈ¡×Ö·û´®ÖеÄijһ¸ö×Ö·û£¬ÆäÖеIJÎÊýindexÖ¸µÄÊÇ×Ö·û´®ÖÐÐòÊý¡£×Ö·û´®µÄÐòÊý´Ó0¿ªÊ¼µ½length()-1 ¡£
ÀýÈ磺String s = new String("abcdefghijklmnopqrstuvwxyz");
System.out.println("s.charAt(5): " + s.charAt(5) );
½á¹ûΪ£º s.charAt(5): f
2. int compareTo(String anotherString) £ºµ±Ç°String¶ÔÏóÓëanotherString±È½Ï¡£ÏàµÈ¹Øϵ·µ»Ø£°£»²»ÏàµÈʱ£¬´ÓÁ½¸ö×Ö·û´®µÚ0¸ö×Ö·û¿ªÊ¼±È½Ï£¬·µ»ØµÚÒ»¸ö²»ÏàµÈµÄ×Ö·û²î£¬ÁíÒ»ÖÖÇé¿ö£¬½Ï³¤×Ö·û´®µÄÇ°Ã沿·ÖÇ¡ÇÉÊǽ϶̵Ä×Ö·û´®£¬·µ»ØËüÃǵij¤¶È²î¡£
3. int compareTo(Object o) £ºÈç¹ûoÊÇString¶ÔÏ󣬺Í2µÄ¹¦ÄÜÒ»Ñù£»·ñÔòÅ׳öClassCastExceptionÒì³£¡£
ÀýÈç:String s1 = new String("abcdefghijklmn");
String s2 = new String("abcdefghij");
String s3 = new String("abcdefghijalmn");
System.out.println("s1.compareTo(s2): " + s1.compareTo(s2) ); //·µ»Ø³¤¶È²î
System.out.println("s1.compareTo(s3): " + s1.compareTo(s3) ); //·µ»Ø'k'-'a'µÄ²î
½á¹ûΪ£ºs1.compareTo(s
Ïà¹ØÎĵµ£º
package javatest1014;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public class ReadExcel{
public static void main(String[] args){
jxl.Workbook workbook=getWorkBook();
......
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 - SQLE ......
ʹÓÃ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.InitialCont ......
ÔÚ½øÈëÎÒÃǽñÌìµÄ»°ÌâÇ°£¬ÏÈÀ´¿´¿´ÏÂÃæÕâ¶Î´úÂ룬ÄãÖªµÀËüµÄ½á¹ûÂð£¿
³ÌÐò´úÂë
public class StringTest1{
public static void main(String[] args) {
String str1 = "abc";
String str2 = "abc";
&nbs ......
¡¡¡¡1¡¢Ê²Ã´ÊÇJavaBean£¿
¡¡¡¡JavaBeanÊÇÃèÊöJavaµÄÈí¼þ×é¼þÄ£ÐÍ£¬ÓеãÀàËÆÓÚMicrosoftµÄCOM×é¼þ¸ÅÄî¡£ÔÚJavaÄ£ÐÍÖУ¬Í¨¹ýJavaBean¿ÉÒÔÎÞÏÞÀ©³äJava³ÌÐòµÄ¹¦ÄÜ£¬Í¨¹ýJavaBeanµÄ×éºÏ¿ÉÒÔ¿ìËÙµÄÉú³ÉеÄÓ¦ÓóÌÐò¡£¶ÔÓÚ³ÌÐòÔ±À´Ëµ£¬×îºÃµÄÒ»µã¾ÍÊÇJavaBean¿ÉÒÔʵÏÖ´úÂëµÄÖظ´ÀûÓ ......