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

java¶¨Ê±Æ÷µÄʹÓÃ

¶¨Ê±Æ÷ÀàTimerÔÚjava.util°üÖС£Ê¹ÓÃʱ£¬ÏÈʵÀý»¯£¬È»ºóʹÓÃʵÀýµÄschedule(TimerTask task, long delay)·½·¨£¬É趨ָ¶¨µÄÈÎÎñtaskÔÚÖ¸¶¨µÄÑÓ³ÙdelayºóÖ´ÐС£¶¨Ê±Æ÷ÈÎÎñÀàTimerTaskÊdzéÏóÀ࣬¼Ì³Ð²¢ÖØдÆärun()·½·¨£¬¿ÉʵÏÖ¾ßÌåÈÎÎñ¡£
schedule(TimerTask task, Date time)É趨ָ¶¨ÈÎÎñtaskÔÚÖ¸¶¨Ê±¼ätimeÖ´ÐС£
cancel()·½·¨½áÊøÕâ¸ö¶¨Ê±Æ÷¡£
schedule(TimerTask task, long delay, long period)·½·¨É趨ָ¶¨ÈÎÎñtaskÔÚÖ¸¶¨ÑÓ³Ùdelayºó½øÐй̶¨ÑÓ³ÙperoidµÄÖ´ÐС£
scheduleAtFixedRate(TimerTask task, long delay, long period)·½·¨É趨ָ¶¨ÈÎÎñtaskÔÚÖ¸¶¨ÑÓ³Ùdelayºó½øÐй̶¨ÆµÂÊperoidµÄÖ´ÐС£
ҪʵÏÖÒ»¸ö¶¨Ê±ÈÎÎñ£¬ÔËÓÃjavaÖеÄTimerºÍTimerTaskÀà¿ÉÒԷdz£ÈÝÒ×ʵÏÖʵʱµ÷Óô¦Àíº¯Êý¡£ÕâÁ½¸öÀàʹÓÃÆðÀ´·Ç³£·½±ã£¬¿ÉÒÔÍê³ÉÎÒÃǶԶ¨Ê±Æ÷µÄ¾ø´ó¶àÊýÐèÒª¡£
¿´¸ö¼òµ¥µÄÀý×Ó:
import java.io.IOException;
import java.util.Timer;
public class TimerTest {
public static void main(String[] args){
Timer timer = new Timer();
timer.schedule(new MyTask(), 1000, 2000);//ÔÚ1ÃëºóÖ´ÐдËÈÎÎñ,ÿ´Î¼ä¸ô2Ãë,Èç¹û´«µÝÒ»¸öData²ÎÊý,¾Í¿ÉÒÔÔÚij¸ö¹Ì¶¨µÄʱ¼äÖ´ÐÐÕâ¸öÈÎÎñ.
while(true){//Õâ¸öÊÇÓÃÀ´Í£Ö¹´ËÈÎÎñµÄ,·ñÔò¾Íһֱѭ»·Ö´ÐдËÈÎÎñÁË
try {
int ch = System.in.read();
if(ch-'c'==0){
timer.cancel();//ʹÓÃÕâ¸ö·½·¨Í˳öÈÎÎñ
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
static class MyTask extends java.util.TimerTask{
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("________");
}
}
}
 
 
ServletÕìÌýÆ÷½áºÏJava¶¨Ê±Æ÷ʵÏÖÈÎÎñ¼Æ»®µ÷¶È[ת]
ºÃ¶àÅóÓÑÓùýWindowsµÄÈÎÎñ¼Æ»®£¬Ò²Óв»ÉÙ³ÌÐòÃÔ×Ô¼ºÔøд¹ýʱÖÓ±¨¾¯¡¢ÏµÍ³×Ô¶¯¹Ø»úµÈȤζ³ÌÐò£¬¿ÉÈ´ºÜÉÙÓÐÅóÓÑÔÚWeb¹¤³ÌÖÐʵÏÖ¹ýÀàËƹ¦ÄÜ¡£½ñÌìÓпհѱÊÕßÏÈÇ°ÔøÔÚTomcatÉÏʵÏÖµÄÀàËƹ¦ÄÜ£¬°á³öÀ´Óë´ó¼Ò¹²Ïí¡£
    ÔçÔÚ¼¸ÄêÇ°£¬ÎÒ¹«Ë¾¸úijÊвÆÕþ¾ÖºÏ×÷ÏîÄ¿¿ª·¢£¬Îª¼ÓÇ¿²ÆÕþ¾Ö¶ÔËùÊôµ¥Î»²ÆÎñ×´¿öµÄÓÐЧ¼à¹Ü£¬¿ª·¢¡¢ÊµÊ©Á˲ÆÕþ¾ÖÊý¾ÝÖÐÐÄÏîÄ¿¡£´ËÏîÄ¿²ÉÓÃB/S¼ÓC/S»ìºÏ½á¹¹Ä£Ê½¡£²ÆÕþ¾ÖWeb·þÎñÆ÷ÉϼÜÉèÊý¾Ýͬ²½½ÓÊÕ×°Öã¬ÓÉÊÐÊôµ¥Î»Ã¿ÌìÏ°àÇ°°Ñ²ÆÎñÐÅϢͨ¹ýHTTPЭÒéÉÏ´«ÖÁ²ÆÕþ¾ÖÖÐÐÄ·þÎñÆ÷£¬ÓëWeb·þÎñÆ÷ÉϵĽÓÊÕ×°ÖöԽӡ£²ÆÕþ¾ÖÄÚ


Ïà¹ØÎĵµ£º

´Ójava³ÌÐòÖе÷ÓÃÆäËü³ÌÐò

RMI (Remote Method Invocation£¬Ô¶³Ì·½·¨µ÷ÓÃ)ÈçºÎÓÃÓÚ³ÌÐò¼äͨѶ£¬ÁíÒ»¸öÓÃÓÚͨѶµÄ¼¼ÊõÊÇRuntime.exec() ·½·¨¡£Äã¿ÉÒÔÓÃÕâ¸ö·½·¨´ÓÒ»¸öÔËÐа¢java³ÌÐòÖе÷ÓÃÁíÒ»¸ö³ÌÐò¡£Runtime.exec Ò²ÔÊÐíÄãÖ´ÐкͳÌÐòÏà¹ØµÄ²Ù×÷£¬ÀýÈç¿ØÖƳÌÐòµÄ±ê×¼ÊäÈëÊä³ö£¬µÈ´ý³ÌÐòµÄ½áÊø²¢µÃµ½ËüµÄÍ˳ö״̬¡£ÏÂÃæÊÇÒ»¸ ......

Java, .Net·¢Õ¹·½ÏòºÍÇ°¾°


Java, .Net·¢Õ¹·½ÏòºÍÇ°¾°
JAVAÓïÑÔ·¢Ã÷ÒÑÓÐ10ÄêÀúÊ·,ÔÚIBM¡¢SUNµÈ¹«Ë¾µÄÍƶ¯ÏÂÒѾ­±È½ÏÎȶ¨Óë³ÉÊ죬»ñµÃÁË´ó¹æÄ£ÆóÒµµÄÆÕ±éÓ¦Óá£Ê±ÖÁ½ñÈÕ£¬J2EEÒѾ­·¢Õ¹³ÉΪһ¸ö¸²¸ÇÃæ¹ã£¬Ð§Âʸߣ¬Ò×ÓÃÐÔÇ¿µÄ¼¼Êõƽ̨£¬ÎüÒýÁË400Íò¿ª·¢Õߣ¬ÔÚÍøÂç¼¼Êõ±é¼°È«ÇòµÄµÄ½ñÌ죬¸üÓÐ17.5ÒŲ́É豸ʹÓÃJAVA¼¼Êõ.ͬʱ, Mustang°æ±¾µÄJ2EEÕýÔÚ½ôÂà ......

JAVAÀ༯¿ò¼ÜÖ÷Òª½Ó¿Ú

13.1.2  À༯¿ò¼ÜÖ÷Òª½Ó¿Ú
ÔÚÕû¸öJavaÀ༯ÖÐ×ʹÓõÄÀ༯½Ó¿ÚÊÇ£ºCollection¡¢List¡¢Set¡¢Map¡¢Iterator¡¢ListIterator¡¢Enumeration¡¢SortedSet¡¢SortedMap¡¢Queue¡¢Map.Entry£¬ÕâЩ½Ó¿ÚµÄ¾ßÌåÌصãÈç±í13-1Ëùʾ¡£
±í13-1  À༯¿ò¼Ü½Ó¿ÚµÄ¾ßÌåÌصã
Ðò    ºÅ
½Ó    ¿Ú
Ãè&nb ......

JAVA AWT ʼþ´¦Àí¼°ÄÚ²¿ÀàµÄʵÏÖ


import java.awt.*;
import java.awt.event.*;
public class TestFrame {
 Frame fm = new Frame();
 public void init(){
  
  fm.setSize(300,300);
  Button btn = new Button("ok");
  
  fm.add(btn);
  btn.addActionListener(ne ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ