javaÖÐStringÓëStringBufferµÄÇø±ð
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
String:
ÊǶÔÏó²»ÊÇÔʼÀàÐÍ.
Ϊ²»¿É±ä¶ÔÏó,Ò»µ©±»´´½¨,¾Í²»ÄÜÐÞ¸ÄËüµÄÖµ.
¶ÔÓÚÒѾ´æÔÚµÄString¶ÔÏóµÄÐ޸Ķ¼ÊÇÖØд´½¨Ò»¸öеĶÔÏó,È»ºó°ÑеÄÖµ±£´æ½øÈ¥.
String ÊÇfinalÀà,¼´²»Äܱ»¼Ì³Ð.
StringBuffer:
ÊÇÒ»¸ö¿É±ä¶ÔÏó,µ±¶ÔËû½øÐÐÐ޸ĵÄʱºò²»»áÏñStringÄÇÑùÖØн¨Á¢¶ÔÏó
ËüÖ»ÄÜͨ¹ý¹¹Ô캯ÊýÀ´½¨Á¢,
StringBuffer sb = new StringBuffer();
note:²»ÄÜͨ¹ý¸¶Öµ·ûºÅ¶ÔËû½øÐи¶Öµ.
sb = "welcome to here!";//error
¶ÔÏó±»½¨Á¢ÒÔºó,ÔÚÄÚ´æÖоͻá·ÖÅäÄÚ´æ¿Õ¼ä,²¢³õʼ±£´æÒ»¸önull.ÏòStringBuffer
Öи¶ÖµµÄʱºò¿ÉÒÔͨ¹ýËüµÄappend·½·¨.
sb.append("hello");
×Ö·û´®Á¬½Ó²Ù×÷ÖÐStringBufferµÄЧÂÊÒª±ÈString¸ß:
String str = new String("welcome to ");
str += "here";
µÄ´¦Àí²½Öèʵ¼ÊÉÏÊÇͨ¹ý½¨Á¢Ò»¸öStringBuffer,Èúîµ÷ÓÃappend(),×îºó
ÔÙ½«StringBuffer toSting();
ÕâÑùµÄ»°StringµÄÁ¬½Ó²Ù×÷¾Í±ÈStringBuffer¶à³öÁËһЩ¸½¼Ó²Ù×÷,µ±È»Ð§ÂÊÉÏÒª´òÕÛ¿Û.
²¢ÇÒÓÉÓÚString ¶ÔÏóÊDz»¿É±ä¶ÔÏó,ÿ´Î²Ù×÷Sting ¶¼»áÖØн¨Á¢ÐµĶÔÏóÀ´±£´æеÄÖµ.
ÕâÑùÔÀ´µÄ¶ÔÏó¾ÍûÓÃÁË,¾ÍÒª±»À¬»ø»ØÊÕ.ÕâÒ²ÊÇÒªÓ°ÏìÐÔÄܵÄ.
¿´¿´ÒÔÏ´úÂ룺
½«26¸öÓ¢ÎÄ×ÖĸÖظ´¼ÓÁË5000´Î£¬
String tempstr = "abcdefghijklmnopqrstuvwxyz";
int times = 5000;
long lstart1 = System.currentTimeMillis();
String str = "";
for (int i = 0; i < times; i++) {
str += tempstr;
}
long lend1 = System.currentTimeMillis();
long time = (lend1 - lstart1);
System.out.println(time);
¿
Ïà¹ØÎĵµ£º
overrideÊÇ·½·¨µÄÖØд£¬Í¨³£·¢ÉúÔÚ×ÓÀàÓ븸ÀàÖ®ÖУ¬Ö¸µÄÊÇ×ÓÀàÖж¨ÒåÁËÒ»¸öÓ븸Àà·µ»ØÖµÀàÐÍ£¬²ÎÊýÀàÐÍÍêÈ«ÏàͬµÄ·½·¨
overloadÊÇ·½·¨µÄÖØÔØ£¬Í¨³£ÔÚͬһ¸öÀàÖУ¬¶¨ÒåÁËÒ»¶Ñ·½·¨ÃûÏàͬ£¬µ«·µ»ØÖµ¿ÉÄܲ»Í¬£¬²ÎÊýÒ²¿ÉÄܲ»Í¬µÄ·½·¨
override£¨ÖØд£©
1¡¢·½·¨Ãû¡¢²ÎÊý¡¢·µ»ØÖµÏàͬ¡£
2¡¢×ÓÀà·½·¨²»ÄÜËõС¸¸Àà·½·¨µÄ·ÃÎÊÈ¨Ï ......
Ãû´Ê
½âÊÍ
aaa
ÈÏÖ¤(authentication)£ºÑéÖ¤Óû§µÄÉí·ÝÓë¿ÉʹÓõÄÍøÂç·þÎñ£»ÊÚȨ(authorization)£ºÒÀ¾ÝÈÏÖ¤½á¹û¿ª·ÅÍøÂç·þÎñ¸øÓû§£»¼ÆÕÊ(accounting)£º¼Ç ¼Óû§¶Ô¸÷ÖÖÍøÂç·þÎñµÄÓÃÁ¿£¬²¢Ìṩ¸ø¼Æ·Ñϵͳ¡£
¼ò³Æaaaϵͳ¡£
awt
abstract window toolkit(³éÏó´°¿Ú¹¤¾ß°ü)£¬µÚÒ»´úµÄ java gui¹¤¾ß°ü£¬ÏÖÔÚ»ù±¾ÒѾ²» ......
2010-05-18
Îå¡¢ÑéÖ¤XML
l ÊôÐÔÁËÌØÕ÷·½·¨
·½ ·¨
·µ»ØÀàÐÍ
²Î Êý
Óï ·¨
setProperty()
void
String propertyId,
Object value
parser.setProperty(“[Property URI]”,
”[Object parameter]”);
setFeature()
void
String feat ......
import java.io.File;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;
import java.text.SimpleDateFormat;
public class FileViewer {
File myDir;
File[] contents;
Vector vectorList;
Iterator currentFileView;
File currentFile;
  ......
¡¡¡¡½ñÌìÒ»ÅóÓѵĹ«Ë¾µ¹±ÕÁË£¬ÔÒò²»ÖªµÀΪʲô¡£ËûÃÇÊǸºÔð¹«Ë¾ERP¿ª·¢µÄ£¬¿ª·¢¹ýºóÒ²¾Í³ÉÁËά»¤ÈËÔ±ÁË£¬ÓõÄÊÇJAVAÄÇһϵÁй¤¾ß×öµÄ¡£Ã»°ì·¨£¬ËäÈ»ÔÚÄÇÀï¸ÉÁ˼¸ÄêÁË£¬ÎªÁËÉú¼Æ»¹µÃÕÒ¹¤×÷£¬¼ÌÐøÕÒJAVA·½ÃæµÄÊ£¬ÃæÊÔÒ²ÃæÁ˼¸¼Ò¹«Ë¾ÁË£¬ÎÒÄÇÅóÓÑÌ«ÀÏʵ£¬ÊÇʲô˵ʲô£¬Ò²²»Ïëµã»ªÀöµÄ´ÊÔ壬½ñÌìËû¸úÎÒËßÁËһͨµÄ¿à£¬ËûºÜÓôà ......