java Timer ѧϰ
TimerλÓÚjava.utilÏÂÃæ£¬Ò»°ã½ÐËûjava¼ÆÊ±Æ÷¡£
javaAPIµÄ½âÊÍÈçÏÂ:
Ò»ÖÖÏß³ÌÉèÊ©£¬ÓÃÓÚ°²ÅÅÒÔºóÔÚºǫ́Ïß³ÌÖÐÖ´ÐеÄÈÎÎñ¡£¿É°²ÅÅÈÎÎñÖ´ÐÐÒ»´Î£¬»òÕß¶¨ÆÚÖØ¸´Ö´ÐС£
ÏÈÀ´¿´¿´Ð§¹û£º
1.Éè¼Æ¼ÆÊ±Æ÷
import java.io.IOException;
import java.util.Calendar;
import java.util.Timer;
public class TimerTest {
public static void main(String args[]) {
Timer timer = new Timer();
ÔÚ1ÃëºóÖ´ÐдËÈÎÎñ,ÿ´Î¼ä¸ô2Ãë,Èç¹û´«µÝÒ»¸öData²ÎÊý,¾Í¿ÉÒÔÔÚij¸ö¹Ì¶¨µÄʱ¼äÖ´ÐÐÕâ¸öÈÎÎñ.
timer.schedule(new MyTask(), 1000, 2000);
while (true) {
int ch;
try {
ch = System.in.read();
if (ch - 'c' == 0) {
timer.cancel();// ʹÓÃÕâ¸ö·½·¨Í˳öÈÎÎñ
System.out.println("½áÊøÈÎÎñ!");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
2.²¼ÖÃÈÎÎñ£º
import com.db.BackupMysql;
public class MyTask extends java.util.TimerTask {
@Override
public void run() {
System.out.println("$$$$$ÃÀÔª¶à¶à$$$$$");
}
}
Ïà¹ØÎĵµ£º
ʹÓÃservletÀ´ÏÂÔØÎļþ£¬ÆäÔÀí·Ç³£¼òµ¥£¬Ö»ÒªµÃµ½ÎļþµÄÊäÈëÁ÷£¨»òÏàÓ¦×Ö½Ú£©£¬È»ºóдÊä³öÁ÷¼´¿É¡£ÏÖ¾ÍÆäÖеöϸ½ÚÎÊÌâÕ¹¿ª£º
1. MIMEÀàÐ͵ÄÉèÖãº
Web ä¯ÀÀÆ÷ʹÓà MIME ÀàÐÍÀ´Ê¶±ð·Ç HTML Îĵµ£¬²¢¾ö¶¨ÈçºÎÏÔʾ¸ÃÎĵµÄÚµÄÊý¾Ý¡£
ÀýÈçEXCELÎļþµÄ MIME ÀàÐÍÊÇ "application/vnd.ms-excel "¡£ÒªÓÃservlet À´´ò¿ªÒ» ......
¼×¹ÇÎÄÒѾÍê³ÉÁ˶ÔSUN¹«Ë¾µÄÊÕ¹º£¬ÓÚ1ÔÂ27ÈÕ·¢²¼Á˶ÔSun¸÷ÏîÒµÎñµÄÕûºÏ¹æ»®¡£×ÜÌåÉÏ˵£¬OracleÒª³ÉΪÈíÓ²¼þÒ»Ì廯µÄÕûÌå½â¾ö·½°¸µÄ³§ÉÌ¡£ ÒÔÏÂ¾ÍÆä¶Ô±¸ÊܹØ×¢µÄJava·½ÃæµÄ²ßÂÔ×ö¸ö½éÉÜ¡£
Java SE:
1£©ÍƳöJDK SE 7£¬ Ëü½«°üÀ¨¶à¸öÐµĹ¦ÄÜ£¬ÈçÌá¸ß¿ª·¢ÈËÔ±µÄЧÂÊ£¬Ìṩ¸ßÐÔÄÜ£¬¶Ô¶àºËоƬµÄÖ§³ÖµÈ¡£
2£©SunµÄHotSp ......
ÓÃjava´´½¨XmlµÄ4´óÀࣺ
Element£º½ÚµãÀà
AttributeÊôÐÔÀà
Document£ºÖ¸µÄ¾ÍÊÇÎĵµÀà
XMLOutput£ºÊä³öÀà
´ËÀàÊÇÓÃjava½¨Á¢Ò»¸öxmlÎļþ
public class TestJdom {
//´´½¨XML£¨Ä£ÐÍ£©dom
public static void main(String[] args) {
  ......
¡¡¡¡inkfish·Ò룬ÇëÎðÉÌÒµÐÔÖÊ×ªÔØ£¬×ªÔØÇë×¢Ã÷À´Ô´£¨http://blog.csdn.net/inkfish
£©¡£±¾ÎÄÊÇÎÒѧϰJUELͬʱ£¬¶ÔÔÍøÕ¾½øÐеļòµ¥µÄ·Ò룬ÔÍøÕ¾µØÖ·£ºhttp://juel.sourceforge.net/guide/basic/factory.html
¡£ËµÊµ»°£¬ÕâÆª·ÒëµÄµÄÈ·²»ÔõÑù¡£
±í´ïʽ¹¤³§£¨Expression Factory£©
¡¡¡¡Èç¹ûҪʹÓÃEL
£¬¾Í±ØÐëÒªÓÐÒ ......
JavaµÄÒ»¸öÖØÒªÓŵã¾ÍÊÇͨ¹ýÀ¬»øÊÕ¼¯Æ÷(Garbage Collection£¬GC)×Ô¶¯¹ÜÀíÄÚ´æµÄ»ØÊÕ£¬³ÌÐòÔ±²»ÐèҪͨ¹ýµ÷Óú¯ÊýÀ´ÊÍ·ÅÄÚ´æ¡£Òò´Ë£¬ºÜ¶à³ÌÐòÔ±ÈÏΪJava²»´æÔÚÄÚ´æÐ¹Â©ÎÊÌ⣬»òÕßÈÏΪ¼´Ê¹ÓÐÄÚ´æÐ¹Â©Ò²²»ÊdzÌÐòµÄÔðÈΣ¬¶øÊÇGC»òJVMµÄÎÊÌâ¡£Æäʵ£¬ÕâÖÖÏë·¨ÊDz»ÕýÈ·µÄ£¬ÒòΪJavaÒ²´æÔÚÄÚ´æÐ¹Â¶£¬µ«ËüµÄ±íÏÖÓëC++²»Í¬¡£
ÎÊÌâµÄÌá ......