ͨ¹ýʹÓÃһЩ¸¨ÖúÐÔ¹¤¾ßÀ´ÕÒµ½³ÌÐòÖеÄÆ¿¾±£¬È»ºó¾Í¿ÉÒÔ¶ÔÆ¿¾±²¿·ÖµÄ´úÂë½øÐÐÓÅ»¯¡£Ò»°ãÓÐÁ½ÖÖ·½°¸£º¼´ÓÅ»¯´úÂë»ò¸ü¸ÄÉè¼Æ·½·¨¡£ÎÒÃÇÒ»°ã»áÑ¡ÔñºóÕߣ¬ÒòΪ²»È¥µ÷ÓÃÒÔÏ´úÂëÒª±Èµ÷ÓÃһЩÓÅ»¯µÄ´úÂë¸üÄÜÌá¸ß³ÌÐòµÄÐÔÄÜ¡£¶øÒ»¸öÉè¼ÆÁ¼ºÃµÄ³ÌÐòÄܹ»¾«¼ò´úÂ룬´Ó¶øÌá¸ßÐÔÄÜ¡£
ÏÂÃ潫ÌṩһЩÔÚJAVA³ÌÐòµÄÉè¼ÆºÍ±àÂëÖУ¬ÎªÁËÄܹ»Ìá¸ßJAVA³ÌÐòµÄÐÔÄÜ£¬¶ø¾³£²ÉÓõÄһЩ·½·¨ºÍ¼¼ÇÉ¡£
1£®¶ÔÏóµÄÉú³ÉºÍ´óСµÄµ÷Õû¡£
JAVA³ÌÐòÉè¼ÆÖÐÒ»¸öÆÕ±éµÄÎÊÌâ¾ÍÊÇûÓкúõÄÀûÓÃJAVAÓïÑÔ±¾ÉíÌṩµÄº¯Êý£¬´Ó¶ø³£³£»áÉú³É´óÁ¿µÄ¶ÔÏ󣨻òʵÀý£©¡£ÓÉÓÚϵͳ²»½öÒª»¨Ê±¼äÉú³É¶ÔÏó£¬ÒÔºó¿ÉÄÜ»¹Ð軨ʱ¼ä¶ÔÕâЩ¶ÔÏó½øÐÐÀ¬»ø»ØÊպʹ¦Àí¡£Òò´Ë£¬Éú³É¹ý¶àµÄ¶ÔÏ󽫻á¸ø³ÌÐòµÄÐÔÄÜ´øÀ´ºÜ´óµÄÓ°Ïì¡£
Àý1£º¹ØÓÚString ,StringBuffer£¬+ºÍappend
JAVAÓïÑÔÌṩÁ˶ÔÓÚStringÀàÐͱäÁ¿µÄ²Ù×÷¡£µ«Èç¹ûʹÓò»µ±£¬»á¸ø³ÌÐòµÄÐÔÄÜ´øÀ´Ó°Ïì¡£ÈçÏÂÃæµÄÓï¾ä£º
String name=new String("HuangWeiFeng");
System.out.println(name+"is my name");
¿´ËÆÒѾºÜ¾«¼òÁË£¬Æäʵ²¢·ÇÈç´Ë¡£ÎªÁËÉú³É¶þ½øÖƵĴúÂ룬Ҫ½øÐÐÈçϵIJ½ÖèºÍ²Ù×÷£º
(1) Éú³ÉеÄ×Ö·û´® new String£¨STR_1);
(2) ¸´ÖƸÃ×Ö·û´®;
(3) ¼ÓÔØ×Ö·û´®³£Á¿"HuangWeiFeng"£¨STR_2);
(4) µ÷ÓÃ×Ö·û´®µÄ¹¹¼ÜÆ÷£¨Constructor£©;
(5) ±£´æ¸Ã×Ö·û´®µ½Êý×éÖУ¨´ÓλÖÃ0¿ªÊ¼£©;
(6) ´Ójava.io.PrintStreamÀàÖеõ½¾²Ì¬µÄout±äÁ¿;
(7) Éú³ÉеÄ×Ö·û´®»º³å±äÁ¿new StringBuffer(STR_BUF_1);
(8) ¸´ÖƸÃ×Ö·û´®»º³å±äÁ¿;
(9) µ÷ÓÃ×Ö·û´®»º³åµÄ¹¹¼ÜÆ÷£¨Constructor£©;
(10) ±£´æ¸Ã×Ö·û´®»º³åµ½Êý×éÖУ¨´ÓλÖÃ1¿ªÊ¼£©;
(11) ÒÔSTR_1Ϊ²ÎÊý£¬µ÷ÓÃ×Ö·û´®»º³å(StringBuffer)ÀàÖеÄappend·½·¨;
(12) ¼ÓÔØ×Ö·û´®³£Á¿"is my name"(STR_3);
(13) ÒÔSTR_3Ϊ²ÎÊý£¬µ÷ÓÃ×Ö·û´®»º³å(StringBuffer)ÀàÖеÄappend·½·¨;
(14) ¶ÔÓÚSTR_BUF_1Ö´ÐÐtoStringÃüÁî;
(15) µ÷ÓÃout±äÁ¿ÖеÄprintln·½·¨£¬Êä³ö½á¹û¡£
ÓÉ´Ë¿ÉÒÔ¿´³ö£¬ÕâÁ½Ðмòµ¥µÄ´úÂ룬¾ÍÉú³ÉÁËSTR_1,STR_2,STR_3,STR_4ºÍSTR_BUF_1Îå¸ö¶ÔÏó±äÁ¿¡£ÕâЩÉú³ÉµÄÀàµÄʵÀýÒ»°ã¶¼´æ·ÅÔÚ¶ÑÖС£¶ÑÒª¶ÔËùÓÐÀàµÄ³¬À࣬ÀàµÄʵÀý½øÐгõʼ»¯£¬Í¬Ê±»¹Òªµ÷ÓÃÀ༫Æäÿ¸ö³¬ÀàµÄ¹¹¼ÜÆ÷¡£¶øÕâЩ²Ù×÷¶¼ÊǷdz£ÏûºÄϵͳ×ÊÔ´µÄ¡£Òò´Ë£¬¶Ô¶ÔÏóµÄÉú³É½øÐÐÏÞÖÆ£¬ÊÇÍêÈ«ÓбØÒªµÄ¡£
¾Ð޸ģ¬ÉÏÃæµÄ´úÂë¿ÉÒÔÓÃÈçϵĴúÂëÀ´Ìæ»»¡£
StringBuffer name=new StringBuffer("HuangWeiFeng");
System.out.println(name.append("is my name.").toString());
ϵͳ½«½øÐÐÈçϵIJÙ×÷£º
(1) Éú³ÉеÄ×Ö·û´®»º³å±äÁ¿new StringBuffer(STR_BUF_1);
(2) ¸´ÖƸÃ×Ö·û´®»º³å±äÁ¿;
(3) ¼ÓÔØ×Ö·û´®³£Á¿"HuangWeiFeng"(STR_1);
(4) µ÷ÓÃ×Ö·û´®»º³åµÄ¹¹¼ÜÆ÷£¨Constructor£©;
(5) ±£´æ¸Ã×Ö·û´®»º³åµ½Êý×éÖУ¨´ÓλÖÃ1¿ªÊ¼£©;
(6) ´Ójava.io.PrintStreamÀàÖеõ½¾²Ì¬µÄout±äÁ¿;
(7) ¼ÓÔØSTR_BUF_1;
(8) ¼ÓÔØ×Ö·û´®³£Á¿"is my name"(STR_2);
(9) ÒÔSTR_2Ϊ²ÎÊý£¬µ÷ÓÃ×Ö·û´®»º³å(StringBuffer)ʵÀýÖеÄappend·½·¨;
(10) ¶ÔÓÚSTR_BUF_1Ö´ÐÐtoStringÃüÁî(STR_3);
(11)µ÷ÓÃout±äÁ¿ÖеÄprintln·½·¨£¬Êä³ö½á¹û¡£
ÓÉ´Ë¿ÉÒÔ¿´³ö£¬¾¹ý¸Ä½øºóµÄ´úÂëÖ»Éú³ÉÁËËĸö¶ÔÏó±äÁ¿£ºSTR_1,STR_2,STR_3ºÍSTR_BUF_1.Äã¿ÉÄܾõµÃÉÙÉú³ÉÒ»¸ö¶ÔÏó²»»á¶Ô³ÌÐòµÄÐÔÄÜÓкܴóµÄÌá¸ß¡£µ«ÏÂÃæµÄ´úÂë¶Î2µÄÖ´ÐÐËٶȽ«ÊÇ´úÂë¶Î1µÄ2±¶¡£ÒòΪ´úÂë¶Î1Éú³ÉÁ˰˸ö¶ÔÏ󣬶ø´úÂë¶Î2Ö»Éú³ÉÁËËĸö¶ÔÏó¡£
´úÂë¶Î1£º
String name= new StringBuffer("HuangWeiFeng");
name+="is my";
name+="name";
´úÂë¶Î2£º
StringBuffer name=new StringBuffer("HuangWeiFeng");
name.append("is my");
name.append("name.").toString();
Òò´Ë£¬³ä·ÖµÄÀûÓÃJAVAÌṩµÄ¿âº¯ÊýÀ´ÓÅ»¯³ÌÐò£¬¶ÔÌá¸ßJAVA³ÌÐòµÄÐÔÄÜʱ·Ç³£ÖØÒªµÄ.Æä×¢ÒâµãÖ÷ÒªÓÐÈçϼ¸·½Ã棻
(1) ¾¡¿ÉÄܵÄʹÓþ²Ì¬±äÁ¿£¨Static Class Variables£©
Èç¹ûÀàÖеıäÁ¿²»»áËæËûµÄʵÀý¶ø±ä»¯£¬¾Í¿ÉÒÔ¶¨ÒåΪ¾²Ì¬±äÁ¿£¬´Ó¶øʹËûËùÓеÄʵÀý¶¼¹²ÏíÕâ¸ö±äÁ¿¡£
Àý£º
public class foo
{
SomeObject so=new SomeObject();
}
¾Í¿ÉÒÔ¶¨ÒåΪ£º
public class foo
{
static SomeObject so=new SomeObject();
}
(2) ²»Òª¶ÔÒÑÉú³ÉµÄ¶ÔÏó×÷¹ý¶àµÄ¸Ä±ä¡£
¶ÔÓÚһЩÀà(È磺StringÀà)À´½²£¬ÄþÔ¸ÔÚÖØÐÂÉú³ÉÒ»¸öеĶÔÏóʵÀý£¬¶ø²»Ó¦¸ÃÐÞ¸ÄÒѾÉú³ÉµÄ¶ÔÏóʵÀý¡£
Àý£º
String name="Huang";
name="Wei";
name="Feng";
ÉÏÊö´úÂëÉú³ÉÁËÈý¸öStringÀàÐ͵ĶÔÏóʵÀý¡£¶øÇ°Á½¸öÂíÉϾÍÐèҪϵͳ½øÐÐÀ¬»ø»ØÊÕ´¦Àí¡£Èç¹ûÒª¶Ô×Ö·û´®½øÐÐÁ¬½ÓµÄ²Ù×÷£¬ÐÔÄܽ«µÃ¸ü²î£¬ÒòΪϵͳ½«²»µÃΪ´ËÉú³É¸ü¶àµÃÁÙʱ±äÁ¿£¬ÈçÉÏÀý1Ëùʾ¡£
(3) Éú³É¶ÔÏóʱ£¬Òª·ÖÅä¸øËüºÏÀíµÄ¿Õ¼äºÍ´óСJAVAÖеĺܶàÀ඼ÓÐËüµÄĬÈϵĿռä·ÖÅä´óС¡£¶ÔÓÚStringBufferÀàÀ´½²£¬Ä¬ÈϵķÖÅä¿Õ¼ä´óСÊÇ16¸ö×Ö·û¡£Èç¹ûÔÚ³ÌÐòÖÐʹÓÃStringBufferµÄ¿Õ¼ä´óС²»ÊÇ16¸ö×Ö·û£¬ÄÇô¾Í±ØÐë½øÐÐÕýÈ·µÄ³õʼ»¯¡£
(4) ±ÜÃâÉú³É²»Ì«Ê¹ÓûòÉúÃüÖÜÆڶ̵ĶÔÏó»ò±äÁ¿¡£¶ÔÓÚÕâÖÖÇé¿ö£¬Òò¸Ã¶¨ÒåÒ»¸ö¶ÔÏ󻺳å³Ø¡£ÒÔΪ¹ÜÀíÒ»¸ö¶ÔÏ󻺳å³ØµÄ¿ªÏúÒª±ÈƵ·±µÄÉú³ÉºÍ»ØÊÕ¶ÔÏóµÄ¿ªÏúСµÄ¶à¡£
(5) Ö»ÔÚ¶ÔÏó×÷Ó÷¶Î§ÄÚ½øÐгõʼ»¯¡£JAVAÔÊÐíÔÚ´úÂëµÄÈκεط½¶¨ÒåºÍ³õʼ»¯¶ÔÏó¡£ÕâÑù£¬¾Í¿ÉÒÔÖ»ÔÚ¶ÔÏó×÷Óõķ¶Î§ÄÚ½øÐгõʼ»¯¡£´Ó¶ø½ÚԼϵͳµÄ¿ªÏú¡£
Àý£º
SomeObject so=new SomeObject();
If(x==1) then
{
Foo=so.getXX();
}
¿ÉÒÔÐÞ¸ÄΪ£º
if(x==1) then
{
SomeObject so=new SomeObject();
Foo=so.getXX();
}
2£®Òì³£(Exceptions)
JAVAÓïÑÔÖÐÌṩÁËtry/catchÀ´·¢·½±ãÓû§²¶×½Òì³££¬½øÐÐÒì³£µÄ´¦Àí¡£µ«ÊÇÈç¹ûʹÓò»µ±£¬Ò²»á¸øJAVA³ÌÐòµÄÐÔÄÜ´øÀ´Ó°Ïì¡£Òò´Ë£¬Òª×¢ÒâÒÔÏÂÁ½µã£º
(1) ±ÜÃâ¶ÔÓ¦ÓóÌÐòµÄÂ߼ʹÓÃtry/catch
Èç¹û¿ÉÒÔÓÃif,whileµÈÂß¼Óï¾äÀ´´¦Àí£¬ÄÇô¾Í¾¡¿ÉÄܵIJ»ÓÃtry/catchÓï¾ä¡£
(2) ÖØÓÃÒì³£
ÔÚ±ØÐëÒª½øÐÐÒì³£µÄ´¦Àíʱ£¬Òª¾¡¿ÉÄܵÄÖØÓÃÒѾ´æÔÚµÄÒì³£¶ÔÏó¡£ÒÔΪÔÚÒì³£µÄ´¦ÀíÖУ¬Éú³ÉÒ»¸öÒì³£¶ÔÏóÒªÏûºÄµô´ó²¿·ÖµÄʱ¼ä¡£
3. Ïß³Ì(Threading)
Ò»¸ö¸ßÐÔÄܵÄÓ¦ÓóÌÐòÖÐÒ»°ã¶¼»áÓõ½Ï̡߳£ÒòΪÏß³ÌÄܳä·ÖÀûÓÃϵͳµÄ×ÊÔ´¡£ÔÚÆäËûÏß³ÌÒòΪµÈ´ýÓ²ÅÌ»òÍøÂç¶Áд¶ø ʱ£¬³ÌÐòÄܼÌÐø´¦ÀíºÍÔËÐС£µ«ÊǶÔÏß³ÌÔËÓò»µ±£¬Ò²»áÓ°Ïì³ÌÐòµÄÐÔÄÜ¡£
Àý2£ºÕýȷʹÓÃVectorÀà
VectorÖ÷ÒªÓÃÀ´±£´æ¸÷ÖÖÀàÐ͵ĶÔÏ󣨰üÀ¨ÏàͬÀàÐͺͲ»Í¬ÀàÐ͵ĶÔÏ󣩡£µ«ÊÇÔÚһЩÇé¿öÏÂʹÓûá¸ø³ÌÐò´øÀ´ÐÔÄÜÉϵÄÓ°Ïì¡£ÕâÖ÷ÒªÊÇÓÉVectorÀàµÄÁ½¸öÌصãËù¾ö¶¨µÄ¡£µÚÒ»£¬VectorÌṩÁËÏ̵߳ݲȫ±£»¤¹¦ÄÜ¡£¼´Ê¹VectorÀàÖеÄÐí¶à·½·¨Í¬²½¡£µ«ÊÇÈç¹ûÄãÒѾȷÈÏÄãµÄÓ¦ÓóÌÐòÊǵ¥Ị̈߳¬ÕâЩ·½·¨µÄͬ²½¾ÍÍêÈ«²»±ØÒªÁË¡£µÚ¶þ£¬ÔÚVector²éÕÒ´æ´¢µÄ¸÷ÖÖ¶ÔÏóʱ£¬³£³£Òª»¨ºÜ¶àµÄʱ¼ä½øÐÐÀàÐ͵ÄÆ¥Åä¡£¶øµ±ÕâЩ¶ÔÏó¶¼ÊÇͬһÀàÐÍʱ£¬ÕâЩƥÅä¾ÍÍêÈ«²»±ØÒªÁË¡£Òò´Ë£¬ÓбØÒªÉè¼ÆÒ»¸öµ¥Ï̵߳ģ¬±£´æÌض¨ÀàÐͶÔÏóµÄÀà»ò¼¯ºÏÀ´Ìæ´úVectorÀà.ÓÃÀ´Ìæ»»µÄ³ÌÐòÈçÏ£¨StringVector.java£©£º
public class StringVector
{
private String [] data;
private int count;
public StringVector()
{
this(10); // default size is 10
}
public StringVector(int initialSize)
{
data = new String[initialSize];
}
public void add(String str)
{
// ignore null strings
if(str == null) { return; }
ensureCapacity(count + 1);
data[count++] = str;
}
private void ensureCapacity(int minCapacity)
{
int oldCapacity = data.length;
if (minCapacity > oldCapacity)
{
String oldData[] = data;
int newCapacity = oldCapacity * 2;
data = new String[newCapacity];
System.arraycopy(oldData, 0, data, 0, count);
}
}
public void remove(String str)
{
if(str == null) { return; // ignore null str }
for(int i = 0; i < count; i++)
{
// check for a match
if(data[i].equals(str))
{
System.arraycopy(data,i+1,data,i,count-1); // copy data
// allow previously valid array element be gc´d
data[--count] = null;
return;
}
}
}
public final String getStringAt(int index)
{
if(index < 0) { return null; }
else if(index > count) { return null; // index is > # strings }
else { return data[index]; // index is good }
}
}
Òò´Ë£¬´úÂ룺
Vector Strings=new Vector();
Strings.add("One");
Strings.add("Two");
String Second=(String)Strings.elementAt(1);
¿ÉÒÔÓÃÈçϵĴúÂëÌæ»»£º
StringVector Strings=new StringVector();
Strings.add("One");
Strings.add("Two");
String Second=Strings.getStringAt(1);
ÕâÑù¾Í¿ÉÒÔͨ¹ýÓÅ»¯Ïß³ÌÀ´Ìá¸ßJAVA³ÌÐòµÄÐÔÄÜ¡£ÓÃÓÚ²âÊԵijÌÐòÈçÏ£¨TestCollection.java£©:
import java.util.Vector;
public class TestCollection
{
public static void main(String args [])
{
TestCollection collect = new TestCollection();
if(args.length == 0)
{
System.out.println("Usage: java TestCollection [ vector | stringvector ]");
System.exit(1);
}
if(args[0].equals("vector"))
{
Vector store = new Vector();
long start = System.currentTimeMillis();
for(int i = 0; i < 1000000; i++)
{
store.addElement("string");
}
long finish = System.currentTimeMillis();
System.out.println((finish-start));
start = System.currentTimeMillis();
for(int i = 0; i < 1000000; i++)
{
String result = (String)store.elementAt(i);
}
finish = System.currentTimeMillis();
System.out.println((finish-start));
}
else if(args[0].equals("stringvector"))
{
StringVector store = new StringVector();
long start = System.currentTimeMillis();
for(int i = 0; i < 1000000; i++) { store.add("string"); }
long finish = System.currentTimeMillis();
System.out.println((finish-start));
start = System.currentTimeMillis();
for(int i = 0; i < 1000000; i++) {
String result = store.getStringAt(i);
}
finish = System.currentTimeMillis();
System.out.println((finish-start));
}
}
}
¹ØÓÚÏ̵߳IJÙ×÷£¬Òª×¢ÒâÈçϼ¸¸ö·½Ã棺
(1) ·ÀÖ¹¹ý¶àµÄͬ²½
ÈçÉÏËùʾ£¬²»±ØÒªµÄͬ²½³£³£»áÔì³É³ÌÐòÐÔÄܵÄϽµ¡£Òò´Ë£¬Èç¹û³ÌÐòÊǵ¥Ị̈߳¬ÔòÒ»¶¨²»ÒªÊ¹ÓÃͬ²½¡£
(2) ͬ²½·½·¨¶ø²»ÒªÍ¬²½Õû¸ö´úÂë¶Î
¶Ôij¸ö·½·¨»òº¯Êý½øÐÐͬ²½±È¶ÔÕû¸ö´úÂë¶Î½øÐÐͬ²½µÄÐÔÄÜÒªºÃ¡£
(3) ¶Ôÿ¸ö¶ÔÏóʹÓöࡱËø¡±µÄ»úÖÆÀ´Ôö´ó²¢·¢¡£
Ò»°ãÿ¸ö¶ÔÏó¶¼Ö»ÓÐÒ»¸ö¡±Ëø¡±£¬Õâ¾Í±íÃ÷Èç¹ûÁ½¸öÏß³ÌÖ´ÐÐÒ»¸ö¶ÔÏóµÄÁ½¸ö²»Í¬µÄͬ²½·½·¨Ê±£¬»á·¢Éú¡±ËÀËø¡±¡£¼´Ê¹ÕâÁ½¸ö·½·¨²¢²»¹²ÏíÈκÎ×ÊÔ´¡£ÎªÁ˱ÜÃâÕâ¸öÎÊÌ⣬¿ÉÒÔ¶ÔÒ»¸ö¶ÔÏóʵÐС±¶àËø¡±µÄ»úÖÆ¡£ÈçÏÂËùʾ£º
class foo
{
private static int var1;
private static Object lock1=new Object();
private static int var2;
private static Object lock2=new Object();
public static void increment1()
{
synchronized(lock1)
{
var1++;
}
}
public static void increment2()
{
synchronized(lock2)
{
var2++;
}
}
}
4£®ÊäÈëºÍÊä³ö(I/O)
ÊäÈëºÍÊä³ö°üÀ¨ºÜ¶à·½Ã棬µ«Éæ¼°×î¶àµÄÊǶÔÓ²ÅÌ£¬ÍøÂç»òÊý¾Ý¿âµÄ¶Áд²Ù×÷¡£¶ÔÓÚ¶Áд²Ù×÷£¬ÓÖ·ÖΪÓлº´æºÍûÓлº´æµÄ£»¶ÔÓÚÊý¾Ý¿âµÄ²Ù×÷£¬ÓÖ¿ÉÒÔÓжàÖÖÀàÐ͵ÄJDBCÇý¶¯Æ÷¿ÉÒÔÑ¡Ôñ¡£µ«ÎÞÂÛÔõÑù£¬¶¼»á¸ø³ÌÐòµÄÐÔÄÜ´øÀ´Ó°Ïì¡£Òò´Ë£¬ÐèҪעÒâÈçϼ¸µã£º
(1) ʹÓÃÊäÈëÊä³ö»º³å
¾¡¿ÉÄܵĶàʹÓûº´æ¡£µ«Èç¹ûÒª¾³£¶Ô»º´æ½øÐÐˢУ¨flush£©,Ôò½¨Ò鲻ҪʹÓûº´æ¡£
(2) Êä³öÁ÷(Output Stream)ºÍUnicode×Ö·û´®
¡¡¡¡µ±Ê±ÓÃOutput StreamºÍUnicode×Ö·û´®Ê±£¬WriteÀàµÄ¿ªÏú±È½Ï´ó¡£ÒòΪËüҪʵÏÖUnicodeµ½×Ö½Ú(byte)µÄת»».Òò´Ë£¬Èç¹û¿ÉÄܵĻ°,ÔÚʹÓÃWriteÀà֮ǰ¾ÍʵÏÖת»»»òÓÃOutputStreamÀà´úÌæWriterÀàÀ´Ê¹Óá£
(3) µ±ÐèÐòÁл¯Ê±Ê¹ÓÃtransient
¡¡¡¡µ±ÐòÁл¯Ò»¸öÀà»ò¶ÔÏóʱ£¬¶ÔÓÚÄÇЩÔ×ÓÀàÐÍ£¨atomic£©»ò¿ÉÒÔÖؽ¨µÄÔËØÒª±íʶΪtransientÀàÐÍ¡£ÕâÑù¾Í²»ÓÃÿһ´Î¶¼½øÐÐÐòÁл¯¡£Èç¹ûÕâЩÐòÁл¯µÄ¶ÔÏóÒªÔÚÍøÂçÉÏ´«Ê䣬ÕâһССµÄ¸Ä±ä¶ÔÐÔÄÜ»áÓкܴóµÄÌá¸ß¡£
(4) ʹÓøßËÙ»º´æ£¨Cache£©
¡¡¡¡¶ÔÓÚÄÇЩ¾³£ÒªÊ¹ÓöøÓÖ²»´ó±ä»¯µÄ¶ÔÏó»òÊý¾Ý£¬¿ÉÒÔ°ÑËü´æ´¢ÔÚ¸ßËÙ»º´æÖС£ÕâÑù¾Í¿ÉÒÔÌá¸ß·ÃÎʵÄËٶȡ£ÕâÒ»µã¶ÔÓÚ´ÓÊý¾Ý¿âÖзµ»ØµÄ½á¹û¼¯ÓÈÆäÖØÒª¡£
(5) ʹÓÃËٶȿìµÄJDBCÇý¶¯Æ÷£¨Driver£©
¡¡¡¡JAVA¶Ô·ÃÎÊÊý¾Ý¿âÌṩÁËËÄÖÖ·½·¨¡£ÕâÆäÖÐÓÐÁ½ÖÖÊÇJDBCÇý¶¯Æ÷¡£Ò»ÖÖÊÇÓÃJAVAÍâ°üµÄ±¾µØÇý¶¯Æ÷£»ÁíÒ»ÖÖÊÇÍêÈ«µÄJAVAÇý¶¯Æ÷¡£¾ßÌåҪʹÓÃÄÄÒ»Öֵøù¾ÝJAVA²¼ÊðµÄ»·¾³ºÍÓ¦ÓóÌÐò±¾ÉíÀ´¶¨¡£
5.һЩÆäËûµÄ¾ÑéºÍ¼¼ÇÉ
(1) ʹÓþֲ¿±äÁ¿¡£
(2) ±ÜÃâÔÚͬһ¸öÀàÖж¯¹ýµ÷Óú¯Êý»ò·½·¨(get»òset)À´ÉèÖûòµ÷ÓñäÁ¿¡£
(3) ±ÜÃâÔÚÑ»·ÖÐÉú³Éͬһ¸ö±äÁ¿»òµ÷ÓÃͬһ¸öº¯Êý£¨²ÎÊý±äÁ¿Ò²Ò»Ñù£©¡£
(4) ¾¡¿ÉÄܵÄʹÓÃstatic,final,privateµÈ¹Ø¼ü×Ö¡£
(5) µ±¸´ÖÆ´óÁ¿Êý¾Ýʱ£¬Ê¹ÓÃSystem.arraycopy()ÃüÁî¡£