JAVAÖÐÓÃÓÚ´¦Àí×Ö·û´®µÄ¡°ÈýÐֵܡ±
JAVAÖÐÓÃÓÚ´¦Àí×Ö·û´®µÄ“ÈýÐֵܔ
JAVAÖÐÓÃÓÚ´¦Àí×Ö·û´®³£ÓõÄÓÐÈý¸öÀࣺjava.lang.String¡¢java.lang.StringBuffer¡¢java.lang.StringBuilder£¬ÕâÈýÕߵĹ²Í¬Ö®´¦¶¼ÊÇfinalÀ࣬²»ÔÊÐí±»¼Ì³Ð£¬ÕâÖ÷ÒªÊÇ´ÓÐÔÄܺͰ²È«ÐÔÉÏ¿¼Âǵģ¬ÒòΪÕ⼸¸öÀ඼ÊǾ³£±»Ê¹ÓÃ×ŵģ¬ÇÒ¿¼Âǵ½·ÀÖ¹ÆäÖеIJÎÊý±»ÐÞ¸ÄÓ°Ïìµ½ÆäËüµÄÓ¦Óá£StringBufferÓëStringBuilderÁ½¸ö»ù±¾Éϲ¶à£¬Ö»ÊÇStringBufferÊÇḬ̈߳²È«£¬¿ÉÒÔ²»ÐèÒª¶îÍâµÄͬ²½ÓÃÓÚ¶àÏß³ÌÖУ»StringBuilderÊÇ·Çͬ²½£¬ÔËÐÐÓÚ¶àÏß³ÌÖоÍÐèҪʹÓÃ×ŵ¥¶Àͬ²½´¦Àí£¬µ«ÊÇËٶȾͱÈStringBuffer¿ì¶àÁË£»¶þÕßÖ®¼äµÄ¹²Í¬µã¶¼¿ÉÒÔͨ¹ýappend¡¢insert½øÐÐ×Ö·û´®µÄ²Ù×÷¡£
StringʵÏÖÁËÈý¸ö½Ó¿Ú£ºSerializable¡¢Comparable<String>¡¢CharSequence£¬¶øStringBuffer¼°StringBuilderֻʵÏÖÁËÁ½¸ö½Ó¿ÚSerializable¡¢CharSequence£¬Ïà±ÈÖ®ÏÂStringµÄʵÀý¿ÉÒÔͨ¹ýcompareTo·½·¨½øÐбȽϣ¬¶øÆäËüÁ½¸ö¾Í²»¿ÉÒÔ¡£
ÒÔÏÂÊÇJDKÖжÔString¡¢StringBuffer¡¢StringBuilderµÄÏêϸ½éÉÜ£º
String£º
String Àà´ú±í×Ö·û´®¡£Java ³ÌÐòÖеÄËùÓÐ×Ö·û´®×ÖÃæÖµ£¨Èç "abc" £©¶¼×÷Ϊ´ËÀàµÄʵÀýʵÏÖ¡£
×Ö·û´®Êdz£Á¿£»ËüÃǵÄÖµÔÚ´´½¨Ö®ºó²»Äܸü¸Ä¡£×Ö·û´®»º³åÇøÖ§³Ö¿É±äµÄ×Ö·û´®¡£ÒòΪ String ¶ÔÏóÊDz»¿É±äµÄ£¬ËùÒÔ¿ÉÒÔ¹²Ïí¡£ÀýÈ磺
String str = "abc";
µÈЧÓÚ£º
char data[] = {'a', 'b', 'c'};
String str = new String(data);
ÏÂÃæ¸ø³öÁËһЩÈçºÎʹÓÃ×Ö·û´®µÄ¸ü¶àʾÀý£º
System.out.println("abc");
String cde = "cde";
System.out.println("abc" + cde);
String c = "abc".substring(2,3);
String d = cde.substring(1, 2);
String Àà°üÀ¨µÄ·½·¨¿ÉÓÃÓÚ¼ì²éÐòÁеĵ¥¸ö×Ö·û¡¢±È½Ï×Ö·û´®¡¢ËÑË÷×Ö·û´®¡¢ÌáÈ¡×Ó×Ö·û´®¡¢´´½¨×Ö·û´®¸±±¾²¢½«ËùÓÐ×Ö·ûÈ«²¿×ª»»Îª´óд»òСд¡£´óСдӳÉä»ùÓÚ Character ÀàÖ¸¶¨µÄ Unicode ±ê×¼°æ¡£
Java ÓïÑÔÌṩ¶Ô×Ö·û´®´®Áª·ûºÅ£¨"+"£©ÒÔ¼°½«ÆäËû¶ÔÏóת»»Îª×Ö·û´®µÄÌØÊâÖ§³Ö¡£×Ö·û´®´®ÁªÊÇͨ¹ý StringBuilder£¨»ò StringBuffer£©À༰Æä append ·½·¨ÊµÏֵġ£×Ö·û´®×ª»»ÊÇͨ¹ý toString ·½·¨ÊµÏֵģ¬¸Ã·½·¨ÓÉ Object ÀඨÒ壬²¢¿É±» Java ÖеÄËùÓÐÀà¼Ì³Ð¡£Óй
Ïà¹ØÎĵµ£º
XSDÎļþ £¨XML Schema ÓïÑÔÒ²³Æ×÷ XML Schema ¶¨Ò壨XML Schema Definition£¬XSD£©¡£ ¾ßÌåʹÓ÷½·¨ºÍ¶¨ÒåÇë²Î¿´£º
http://www.w3school.com.cn/schema/index.asp
java×Ôjdk1.5ÒÔÉÏÐÂÔöÁËSchemaFactoryÀà ¿ÉÒÔʵÏÖ¶ÔXSDÑéÖ¤µÄÖ§³Ö£¬Ê¹ÓÃÆðÀ´Ò²ºÜ·½±ã¡£
ÒÔÏ´úÂë¿ÉÓÃÔÚJDK1.5+ ÑéÖ¤xml
public class SimpleErrorHandler i ......
LombokÊÇÒ»ÖÖJavaArchive(JAR)Îļþ£¬¿ÉÓÃÀ´Ïû³ýJava´úÂëµÄÈß³¤¡£Í¨¹ýÔÚ¿ª·¢»·¾³ÖÐʵÏÖLombok£¬¿ª·¢ÈËÔ±¿ÉÒÔ½ÚÊ¡¹¹½¨ÖîÈçhashCode()ºÍequals()ÕâÑùµÄ·½·¨ÒÔ¼°ÒÔÍùÓÃÀ´·ÖÀà¸÷ÖÖaccessorºÍmutatorµÄ´óÁ¿Ê±¼ä¡£
ÎÒÃÇ¿´ÕâÑùÒ»¸öÀý×Ó£¬Ò»¸ö±ê×¼µÄJavabean¡£Ò»¸öµäÐ͵ÄJavabeanÒ»°ã¾ßÓм¸¸öÊôÐÔ¡£Ã¿¸öÊôÐÔ¾ßÓÐÒ»¸öaccessorºÍmutat ......
ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄÊÂÇ飬µ«ÊÇ£¬ÎÒÃǵ½µ×ÉùÃ÷ÁËʲô£¿»Ø´ðͨ³£ÊÇ£ºÒ»¸öString£¬ÄÚÈÝÊÇ“Hello world!”¡£ÕâÑùÄ£ºýµÄ»Ø´ðͨ³£ÊǸÅÄî²»ÇåµÄ¸ùÔ´¡£Èç¹ûҪ׼ȷµÄ»Ø´ð£¬Ò»°ëµÄÈË´ó¸Å»á»Ø´ð´íÎó¡£
Õâ
¸öÓï¾äÉùÃ÷µÄÊÇÒ»¸öÖ¸Ïò¶ÔÏóµÄÒýÓã¬ÃûΪ“s ......
1.ÈçºÎ»ñµÃÊý×éµÄ³¤¶È£¿
Êý×éÃû.length
2.·ÃÎÊÐÞÊηû“public/private/protected/ȱʡµÄÐÞÊηû”µÄʹÓÃÀà?
public : ¹«¹²,¾ù¿É·ÃÎÊ
private: ˽ÓеÄ,ͬһ¸öjavaÀàÖпÉÒÔ·ÃÎÊ.×ÓÀ಻ÄÜ·ÃÎÊ.
protected: ͬһ¸ö°üÖеÄÀ඼¿É·ÃÎÊ.×ÓÀà¿ÉÒÔ·ÃÎÊ.
ȱʡ,friendly :µ±Ç°Àà,ͬһ¸ö°ü,¶¼¿ÉÒÔ·ÃÎÊ.
×÷ÓÃÓò µ± ......
package com.tonglian.test;
import java.util.TimerTask;
//TimerTaskÊǸöÐéÀ࣬ÆäÖÐÓÐÒ»¸örun()
public class Work extends TimerTask{
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("tttt/n");
}
}
//¹¦ÄÜ£ºÃ¿¸ô1Ãë¾Í»áµ ......