javaÖÐÈÕÆÚ¡¢ÈÕÆÚ¸ñʽ¡¢ÈÕÆÚ¼ÆËãѧϰ±Ê¼Ç
2. Calendar ¶ÔÏóµÄÈÝ´íÐÔ£¬Lenient ÉèÖà ÎÒÃÇÖªµÀÌض¨µÄÔ·ÝÓв»Í¬µÄÈÕÆÚ£¬µ±Ò»¸öÓû§¸ø³ö´íÎóµÄÈÕÆÚʱ£¬Calendar ÈçºÎ´¦ÀíµÄÄØ£¿ import java.io.*;
import java.util.*; public class WhatIsCalendar
{
public static void main(String[] args) throws Exception{
Calendar cal1 = Calendar.getInstance();
cal1.set(2000, 1, 32, 0, 0, 0);
System.out.println(cal1.getTime());
cal1.setLenient(false);
cal1.set(2000, 1, 32, 0, 0, 0);
System.out.println(cal1.getTime());
}
} ËüµÄÖ´Ðнá¹ûÊÇ£º Tue Feb 01 00:00:00 PST 2000
Exception in thread "main" java.lang.IllegalArgumentException
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:1368)
at java.util.Calendar.updateTime(Calendar.java:1508)
at java.util.Calendar.getTimeInMillis(Calendar.java:890)
at java.util.Calendar.getTime(Calendar.java:871)
at WhatIsCalendar.main(WhatIsCalendar.java:12) µ±ÎÒÃÇÉèÖøà Calendar Ϊ Lenient false ʱ£¬Ëü»áÒÀ¾ÝÌض¨µÄÔ·ݼì²é³ö´íÎóµÄ¸³Öµ¡£ 3. ²»Îȶ¨µÄ Calendar ÎÒÃÇÖªµÀ Calendar ÊÇ¿ÉÒÔ±» serialize µÄ£¬µ«ÊÇÎÒÃÇҪעÒâÏÂÃæµÄÎÊÌâ import java.io.*;
import java.util.*; public class UnstableCalendar implements Serializable
{ public static void main(String[] args) throws Exception{
Calendar cal1 = Calendar.getInstance();
cal1.set(2000, 7, 1, 0, 0 , 0);
cal1.set(Calendar.MILLISECOND, 0);
ObjectOutputStream out =
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
½ñÌìÔÙÂÛ̳¿´µ½ÁËÓÐÈËÎÊJAVAÃüÃû¹æ·¶£¬ÎÒ¾õµÃÕâ¸öÎÊÌâµÄÈ·ÐèҪעÖØÒ»ÏÂ
ÒòΪ¶ÔÓÚÒ»¸ö³ÌÐòÀ´Ëµ ³ÌÐòµÄ¸ñʽÊǷdz£ÖØÒª£¬Ãû×ÖÆð³ÉʲôÑù¿ÉÒÔ¿´³öÕâ¸öÈ˵ıà³ÌÄÜÁ¦£¬
Èç¹ûÒ»¸öÈ˵ijÌÐòдµÄ·Ç³£µÄÂÒ£¬Ãû×Öûһµã¹æ·¶µÄ»°»á¾õµÃ³ÌÐòºÜ"³ó"£¬Õâ»áÈöÁÕ߸ù±¾Ã»
ÐÄ˼ÍùÏ¿´
ÏÂÃæÕª×ÔÂÛ̳һÍøÓѶÔÃüÃû¹æ·¶µÄ×ܽ᣺
1.°ü
ÓÉСР......
JDK1.4ÖÐ
Map map = new HashMap();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object value = entry.getValue();
}
JDK1.5ÖÐ,Ó¦ÓÃÐÂÌØÐÔFor-EachÑ»·
Map m = new HashMap(); ......
Tomcat ϵĶ¨Ê±ÈÎÎñ
SysContextListener.java
package axtic.servlet;
import java.util.Timer;//¶¨Ê±Æ÷Àà
import axtic.bean.exportHistoryBean;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class SysContextListener implements ServletContextListener
......