Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Effective Java¶ÁÊé±Ê¼Ç

package chape8;
/**
* µÚ8ÕÂ
* µÚ46條£º
* for-eachÑ­環優ÏÈÓÚforÑ­環
* for(Element e : c)
* {
* dosomthing(e);
* }
* Õâ¸öÊÇjava1.5ÒÔÉϵİ汾µÄforÑ­»·µÄÊ×ÏÈ¿¼ÂǵÄд·¨
* ÒÔÏÂÊÇjava1.5ÒÔÇ°µÄ寫·¨
*  for (Iterator it = c.iterator();it.hasNext();)
{
it.next();
}
這兩個Ñ­環µÄ·½·¨¶¼±Èwhile·½·¨ÒªºÃ£¬45條ÖеÄ複製µÄ錯誤ÔÚÓõÚÒ»種Ñ­環¾Í
¿ÉÒÔ±ÜÃ⣻
總Ö®for eachÔÚ簡潔ºÍ預·Àbug·½ÃæÓÐÖø傳統µÄforÑ­環無·¨±ÈµÄ優勢£»並ÇÒ沒ÓÐÐÔÄÜ
損ʧ¡£應該¾¹¿ÉÄÜʹÓÃfor-each µ«ÊÇÓÐÏÂ麵Èý種Çé況無·¨Ê¹ÓÃfor each
1.過濾£ºÈç¹û±éÀúÒ»¸ö¼¯ºÏ ²¢É¾³ýÑ¡¶¨µÄÔªËØ ¾ÍÒªÓÃÏÔʾµÄµü´úÆ÷£¬ÕâÑù¿ÉÒÔµ÷ÓÃ
ËûµÄremove·½·¨
2.ת»»£ºÒª±éÀúÁбí»òÕßÊý×é ²¢È¡´úËûµÄ²¿·Ö»òÕßÈ«²¿ÔªËØÖµ ÒªÓõ½Êý×éµÄË÷Òý
3.ƽÐеü´úÒª²¢ÐбéÀú¶à¸ö¼¯ºÏ£»
* @author lee
*
*/
public class Chape46 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}


Ïà¹ØÎĵµ£º

java elÅäÖúÍʹÓÃ


Ê×ÏÈÈ·¶¨ÓõÄServlet / JSPµÄ°æ±¾¡£
²é¿´web.xmlµÄ¿ªÍ·²¿·Ö£¬Èç¹ûÓÐÒÔÏÂÄÚÈÝ£¬±íʾÊÇServlet 2.4 / JSP 2.0¡£
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.s ......

java¼¯ºÏÀà

 ArrayList ºÍVectorÊDzÉÓÃÊý×鷽ʽ´æ´¢Êý¾Ý£¬´ËÊý×éÔªËØÊý´óÓÚʵ¼Ê´æ´¢µÄÊý¾ÝÒÔ±ãÔö¼ÓºÍ²åÈëÔªËØ£¬¶¼ÔÊÐíÖ±½ÓÐòºÅË÷ÒýÔªËØ£¬µ«ÊDzåÈëÊý¾ÝÒªÉè¼Æµ½Êý×éÔªËØÒƶ¯µÈÄÚ´æ²Ù×÷£¬ËùÒÔË÷ÒýÊý¾Ý¿ì²åÈëÊý¾ÝÂý£¬VectorÓÉÓÚʹÓÃÁËsynchronized·½·¨£¨Ḭ̈߳²È«£©ËùÒÔÐÔÄÜÉϱÈArrayListÒª²î£¬LinkedListʹÓÃË«ÏòÁ´±íʵÏÖ´æ´¢£¬°´Ðòº ......

javaÏß³Ì

1.Ï̴߳´½¨µÄÁ½ÖÖ·½Ê½
1£©À©Õ¹ThreadÀಢÖØдpublic void run()·½·¨
ps£º
¶¨ÒåỊ̈߳º
class myThread extends Thread(){
         public void run(){
                System.out.println("Ju ......

JAVA AJAX½Ì³ÌµÚËÄÕ—AJAXºÍMVCµÄ¼òµ¥½áºÏ

 ÕâÀïÎÒÃÇÔÙÀí½âÁËAJAXºó£¬¿ªÊ¼À´ÓÃʵÀý¸ÐÊÜAJAXµÄÁ¦Á¿¡£
½ñÌìÎÒ×îºóҪʵÏÖµÄЧ¹û£¬µ±Êó±ê·Åµ½Í¼Æ¬ÉÏʱ»á¸ù¾Ý£¬»á°ÑÊý¾Ý¿â¿âÀïµÄÊý¾Ý¶Á³ö£¬Í¨¹ýÏÔʾ¿òÏÔʾ³öÀ´¡£Õâ¸öÔںܶàÍøÉÏÉ̵궼ÓÐÓõ½ÕâÀïЧ¹û£¬ÎÒÃÇÕâÀïÓÃAJAXÀ´ÊµÏÖÕâ¸öЧ¹û¡£Õâ¸öʵÀýÀï½áºÏÁËMySql¡¢Servlet»¹ÓÐJs£¬ÀíÂÛÐÔºÜÉÙ£¬µ«Í¨¹ýʵ¼ùÀ´¸ÐÊÜÀíÂÛ֪ʶ¡£
......

java¶ÁÈ¡ excel Îı¾

 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();
        ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ