Effective Java¶ÁÊé±Ê¼Ç
package chape8;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* µÚ°ËÕ ͨÓóÌÐòÉè¼Æ
* µÚ45Ìõ£º ½«¾Ö²¿±äÁ¿µÄ×÷ÓÃÓò¼õСµ½×îС
* ½«¾Ö²¿±äÁ¿µÄ×÷ÓÃÓò×îС»¯¡£¿ÉÒÔÔöÇ¿´úÂëµÄ¿É¶ÁºÍ¿Éά»¤ÐÔ£¬²¢½µµÍ³ö´íµÄ¿ÉÄÜÐÔ
* Ҫʹ×÷ÓÃÓò×îС£¬×îÓÐÁ¦µÄ·½·¨¾ÍÊÇÔÚµÚÒ»´ÎʹÓÃËüµÄʱºòÉùÃ÷£»Èç¹ûÌáÇ°ÉùÃ÷»áÔì³É
* һƬ»ìÂÒ£»Ò²»á·ÖÉ¢×¢ÒâÁ¦
* ¼¸ºõÿ¸ö¾Ö²¿±äÁ¿µÄÉùÃ÷¶¼Ó¦¸Ã°üÀ¨Ò»¸ö³õʼ»¯µÃ±í´ïʽ£»
* ÀýÈ磺
* for(Element e : c)
* {
* dosomthing(e);
* }
* Õâ¸öÊÇjava1.5ÒÔÉϵİ汾µÄforÑ»·µÄÊ×ÏÈ¿¼ÂǵÄд·¨£»
* ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£
* ÔÙÀ´¿´£ºÏÂÃæÊÇjava1.5ÒÔÇ°µÄforÑ»·
* List c = new ArrayList ();
Iterator it = c.iterator();
while(it.hasNext())
{
it.next();
}
List c1 = new ArrayList();
Iterator it1 = c1.iterator();
while(it.hasNext())
{
it1.next();
}
* µ«Äã±È½ÏÒ»ÏÂÕâÁ½¸öÑ»·£¬µÚ¶þ¸öÑ»·ÊÇÎÒÒªµÄµÚ¶þ¸öÑ»· ÎÒΪÁË·½±ã½«µÚÒ»¸öÑ»·
* ¸´ÖÆÁËÒ»·Ý £¬È»ºó¸Ä±äÁ˱äÁ¿µÄÃû³ÆÀ´´ïµ½Á½¸öÑ»·µÄÄ¿µÄ£¬這樣寫 ide²»會報錯
* µ«ÊÇÏÔÈ»ÎÒÍüÁËÐÞ¸ÄһЩ±ØÐëÐ޸ĵĶ«Î÷£¬µ«ÊǵÚÒ»¸öÑ»·ÖеÄitÔÚµÚ¶þ¸öµÄ×÷ÓÃÓòÖÐÒÀÈ»ÓÐЧ ÕâÑù»áÔì³ÉÄãÈÏΪ
* ĪÃûÆäÃîµÄÎÊÌ⣻
* Èç¹û這樣寫£º
* List c = new ArrayList ();
for (Iterator it = c.iterator();it.hasNext();)
{
it.next();
}
List c1 = new ArrayList();
while(Iterator it1 = c1.iterator();it.hasNext();)
{
it1.next();
}
µÚÒ»個Ñ環ÖеÄ變Á¿µÄ×÷ÓÃÓò²»會Ó°響µ½µÚ¶þ個 這樣ide¾Í會報錯 ¿ÉÒÔ¼°時¸Ä³É£»
將¾Ö²¿變Á¿µÄ×÷ÓÃÓò×îС»¯ ʹ·½·¨Ð¡¶ø¼¯ÖУ¬將ÄÜ·Ö開µÄ·½·¨¶¼·Ö開£»
* @author lee
*
*/
public class Chape45 {
public static void main(String[] args) {
/*List c = new ArrayList ();
Iterator it = c.iterator();
while(it.hasNext())
{
it.next();
}
List c1 = new ArrayList();
Iterator it1 = c1.iterator();
while(it.hasNext())
{
it1
Ïà¹ØÎĵµ£º
from: http://blog.csdn.net/WOSHISUNXIANGFU/archive/2008/08/25/2828634.aspx
1.½éÉÜ
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒÌض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµ ......
Éè¼ÆÒ»¸öCircleÀ࣬ÆäÊôÐÔΪԵ㣨ÀàÐÍΪÀàMyPoint£©ºÍ°ë¾¶£¬²¢Îª´ËÀà±àдÒÔÏÂÈý¸ö·½·¨£º
Ò»¡¢¼ÆËãÔ²µÄÃæ»ýµÄcalArea£¨£©·½·¨£»
¶þ¡¢¼ÆËãÖܳ¤µÄcalLength£¨£©·½·¨£»
Èý¡¢boolean inCircle£¨MyPoint mp£©·½·¨£¬¹¦ÄÜÊDzâÊÔ×÷Ϊ²ÎÊýµÄij¸öµãÊÇ·ñÔÚµ±Ç°¶ÔÏóÔ²ÄÚ£¨Ô²ÄÚ£¬°üÀ¨Ô²ÉÏ·µ»Øtrue£¬ÔÚÔ²Íâ·µ»Øfalse£©¡£
³ÌÐò£º
clas ......
¾Í¶àÏß³ÌÀ´Ëµ£¬ÎÒÃÇ¿ªÊ¼ÉèÏëÖ»ÓÐÁ½¸öỊ̈߳¨>2ʱÊDz»ÊÇËãÊýѧ¹éÄÉ·¨£¿£©ÄÇôÈç¹ûÁ½¸ö¶ÀÁ¢µÄÏ̻߳ᷢÉúʲôÄØ£¿
1¡£µ±Ò»¸öÏ߳̽øÈëmoniter£¨Ò²¾ÍÊÇ˵վÓÃÒ»¸öobject£©£¬ÁíÒ»¸öÏß³ÌÖ»Óеȴý»ò·µ»Ø£¬¶øÎÒÃÇ°Ñ·µ»Ø¾Í³ÆΪһÖÖģʽ£¬ÕâÖÖģʽµÄÓ¢ÎÄÊÇBalking¡£
2¡£ÕâÁ½¸öÏ߳̿ÉÒÔÊÇÓÐÐòµÄÖ´ÐУ¬¶ø²»ÊÇÈÃOSÀ´µ÷¶È£¬ÕâʱΠ......
ÔÚJavaÓïÑÔÖУ¬Ò»°ã²»ÐèÒª×Ô¶¨Òåequals()ºÍhashCode()ÕâÁ½¸ö·½·¨£¬µ±ÐèÒª¶Ô¶ÔÏóµÄÄÚÈݽøÐбȽϵÄʱºò£¬²ÅÐèÒªÕâÑùÁ½¸ö·½·¨¡£ÀýÈ磬ÐèÒª°Ñ¶ÔÏó·ÅÈëHashSet»òÕ߰ѶÔÏó×÷Ϊkey·ÅÈëHashMap¡¢ Hashtableʱ£¬Èç¹û²»Ïë°Ñ¾ßÓÐÏàͬÄÚÈݵÄÁ½¸ö¶ÔÏó×÷ΪÁ½¸ö¶ÔÏóÀ´¿´´ý£¬¾ÍÐèÒªÖض¨ÒåÕâÁ½¸ö·½·¨¡£ÕâÁ½¸ö·½·¨µÄʹÓÃÊÇ ......
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();
......