Effective Java ѧϰ±Ê¼Ç (6)
¼°Ê±Ïû³ý²»Ê¹ÓõĶÔÏóµÄÒýÓÃ, ÀíÂÛÉÏ, ´øÓÐÄÚ´æ¹ÜÀíµÄÓïÑÔÊDz»´æÔÚÄÚ´æй©µÄ, µ«ÊÇÈç¹û¶Ô¶ÔÏóµÄ²Ù×÷²»µ±,Ò²ÊÇ¿ÉÄÜ»áÔì³ÉÄÚ´æй©.
ÈçÓÐÒ»¸östack, Æäpopº¯ÊýÈçÏÂ.
public Object pop()
{
if( Element.length() == 0) return null;
return Element[size—];
}
ÕâÑùµÄ´úÂë³õ¿´ºÃÏñûÓÐʲôÎÊÌâ, µ±Õ»Ôö¼ÓÔÙ¼õÉÙºó, ÔÀ´µÄÊý×éÖÐÈÔÈ»´æÔÚ±»POPµÄÄǸö¶ÔÏóµÄÒýÓÃ! ÕýÈ·´ð°¸Ó¦¸ÃÊÇ:
public Object pop()
{
if( Element.length() == 0) return null;
Object ele = Element[—size];
Element[size] =null;
return ele;
}
È»¶øʵ¼ÊÉÏ,ÎÒÃDz»ÓÃÔÚ³ÌÐòÖÐдÂúÀàËÆXXX=nullµÄÇé¿ö, ÀàËÆÕâÑùµÄ´¦ÀíÓ¦¸ÃÊÇÀýÍâµÄÉÙÊý×ö·¨¶ø²»ÄÜ¿´³É³£¹æ×ö·¨, ·ñÔò³ÌÐòµÄ½á¹¹¾Í²»¹»ÇåÎú.
Ò»°ã˵À´,Ö»Óе±Ò»¸öÀà×Ô¼º¹ÜÀíÄÚ´æʱ,²ÅҪСÐÄÄÚ´æй©.
»¹Á½¸öµØ·½,Ò»¸öÊÇ»º´æ, ±»»º´æµÄÎïÌå¾³£±»ÒÅÍü.
»¹ÓоÍÊÇlistenerºÍcallbackµÄº¯Êý, ¾³£ÊÇ×¢²áºó, ÔÚ²»Ê¹ÓÃÁË,Íü¼ÇÁË"derigster”, µ¼ÖÂÕâ¿éÏà¹ØµÄÄÚ´æ²»ÎÞÇå³ý
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/mutsinghua/archive/2010/01/23/5245558.aspx
Ïà¹ØÎĵµ£º
ÎÊÌâ
ÔÚǰһС½Ú£¬½éÉÜÁËÔÚ¶àÏ̱߳à³ÌÖÐʹÓÃͬ²½»úÖƵÄÖØÒªÐÔ£¬²¢Ñ§»áÁËÈçºÎʵÏÖͬ²½µÄ·½·¨À´ÕýÈ·µØ·ÃÎʹ²Ïí×ÊÔ´¡£ÕâЩÏß³ÌÖ®¼äµÄ¹ØϵÊÇƽµÈµÄ£¬±Ë´ËÖ®¼ä²¢²»´æÔÚÈκÎÒÀÀµ£¬ËüÃǸ÷×Ô¾ºÕùCPU×ÊÔ´£¬»¥²»ÏàÈ㬲¢ÇÒ»¹ÎÞÌõ¼þµØ×èÖ¹ÆäËûÏ̶߳Թ²Ïí×ÊÔ´µÄÒì²½·ÃÎÊ¡£È»¶ø£¬Ò²ÓкܶàÏÖʵÎÊÌâÒªÇó²»½öҪͬ²½µÄ·ÃÎÊͬһ¹²Ïí×ÊÔ´£¬¶øÇ ......
±¾ÎÄÌṩjava¶àÏ̷ֱ߳ð¶¨Ê±¶Áдͬһ¸öÎļþµÄÑùÀý£¬ÆäÖÐÁ½¸öỊ̈߳¬Ò»¸öÿ·ÖÖÓдÈ뵱ǰʱ¼äµ½Ö¸¶¨Îļþ£¬ÁíÒ»¸öÏ̶߳Á³öÿ·ÖÖÓÐÂдµÄÄÚÈÝ¡£
ʹÓüòµ¥µÄThread.sleep¼¼ÊõʵÏÖ¶¨Ê±
package test.thread;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
im ......
package com.yzy;
import java.util.regex.*;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
Pattern p=Pattern.compile("^[a-z]+");
Matcher m=p.matcher("a233"); //true
//Matcher m=p.matcher("2233") ......
×î½üÏëʵÏÖÒ»¸öÔÚ×Ô¼ºÊÖ»úÉϲéѯºº×ÖÆ´ÒôµÄ³ÌÐò£¬ÒѾ½øÐÐÁË´ó¸Å20ÌìÁË°É¡£µ«ÊÇÉÏÖܵÄʱºòÔÚNetbeans 6.8ÖÐÔËÐгÌÐò£¬ÔÚÊä³öÖÐÏÔʾµÄÊÇ“Starting emulator in execution mode”£¬Ä£ÄâÆ÷È´Æô¶¯²»ÆðÀ´¡£È¥²é¿´°²×°µÄJavaƽ̨£¬ÏÔʾÓÐ Java ME£¬³¢ÊÔ°ÑËüɾ³ýºó£¬»µÁË£¬ÔõÁËÒ²ÎÞ·¨ÔÙ´ÎÌí¼Ó£¬Ã÷Ã÷Ö¸¶¨ÁËĿ¼£¬È´ÌáÊ¾Õ ......
½ñÌìÔÚ¹äÂÛ̳µÄʱºò¿´µ½ÓÐÈ˽ò½òÀÖµÀ£º´ÓC++¸Éµ½×ªÐÍΪjavaÊÇÍ˲½
ÎÒ²»ÈÏΪÊÇÕâÑù£¬Ê×ÏÈÓ¦¸ÃÒ»¸öÈ˵ÄÐËȤ£¬¼ÓÉÏÕâÃÅÓïÑÔ£¬ÕâÃŹ¤×÷ÊÇ·ñ·ûºÏÄã
¸É×Ô¼ºÏ²»¶µÄÓïÑÔ±àÂë²ÅÊÇ×îÖØÒªµÄ£¬µ±È»java±È½ÏÈÝÒ׵㣬ÎÒÒ²ÊÇÕâÑùÈÏΪµÄ
µ«ÊÇjava²¢²»ÊÇ´ó¼ÒËù˵µÄÄÇôÈÝÒ×£¬µ±½ñÉç»á˲»¸Ò˵×Ô¼º»ássh£¬µ±ÊÇ×Ô¼ºÎÊÐÄ×Ô¼ºÑ§µÃÓжàºÃ£¬
ÔÚ ......