Java count down
public static void main(String[] args){
SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
String aimTime ="2010-02-03 17:30:00.000";
int count = 0;
Date aimDate = da.parse(aimTime,new ParsePosition(0));
long subTime = aimDate.getTime() - System.currentTimeMillis();
while (true) {
double subTimeD = new
Long(subTime).doubleValue();
double lastDay = subTimeD/(24.0*3600.0*1000.0);
// System.out.println("Ê£Óࣺ"+lastDay+"Ìì");
double lastHour = subTimeD/(3600.0*1000.0)-Math.floor(lastDay)*24.0;
// System.out.println("Ê£Óࣺ"+lastHour+"Сʱ");
double lastMinute = subTimeD/(60.0*1000.0)-Math.floor(lastDay)*24.0*60.0-Math.floor(lastHour)*60.0;
// System.out.println("Ê£Óࣺ"+lastMinute+"·ÖÖÓ");
double lastSecond = subTimeD/(1000.0)-Math.floor(lastDay)*24.0*60.0*60.0-Math.floor(lastHour)*60.0*60.0-Math.floor(lastMinute)*60.0;
// System.out.println("Ê£Óࣺ"+lastSecond+"Ãë");
count++;
System.out.println(count+" last "+
Math.floor(lastDay) + " DAY " +
Math.floor(lastHour) + " HOUR " +
Math.floor(lastMinute) + " MINUTES " + new DecimalFormat("0.0").format(lastSecond) + " SECONDS");
subTime = subTime-100;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Ïà¹ØÎĵµ£º
¹ØÓÚZKÕâ¸ö¿ò¼Ü,¹úÄÚʹÓõÄÓû§Ó¦¸Ã±È½ÏÉÙ,¹úÄÚµÄ×ÊÁÏÒ²Ï൱µÄÉÙ,µ«ÊÇÔÚ¹úÍâ,Õâ¸ö¶«Î÷ÒѾºÜ¶àÈËÔÚʹÓÃÁË,ÒÔǰҲûÔõô½Ó´¥¹ý,×î½ü¿ªÊ¼Ê¹ÓÃZKÀ´×ö¿ª·¢,·¢ÏÖÕⶫÎ÷ÔÚʹÓõÄʱºò,»¹ÂùÓÐÒâ˼µÄ,ËùÒÔ×¼±¸¼ÇÏÂʹÓÃÈÕÖ¾,Áô¸øÒÔºó»Ø¹ËºÍ´ó¼Ò·ÖÏí
Ê×ÏÈÐèÒªÖªµÀZKÊÇÒ»¸öʲô¶«Î÷,Õâ¸ö¿ò¼ÜÊÇÎÒ¹ų́ÍåµÄÅóÓÑ¿ª·¢µÄ,ËûÊÇÒ»¸öʼþÇý¶¯(e ......
Æä¼¼ÇɾÍÊÇ£º¶¨ÒåÒ»¸ö¼òµ¥½Ó¿Ú£¬²¢ÔڸýӿÚÖÐÉùÃ÷ÎÒÃÇÒªµ÷Óõķ½·¨£¬Ò»°ã¿ÉÒÔÓ¦ÓÃÔÚ¼üÅÌÊó±êʼþ¸ú×Ù¡£
ÏÂÃæ¾ÙÒ»¸öÀý×Ó£º
¼Ù¶¨ÎÒÃÇÏ£ÍûÔÚij¸öʼþ·¢ÉúʱµÃµ½Í¨Öª¡£ÎÒÃÇ¿ÉÒÔ¶¨ÒåÒ»¸ö½Ó¿Ú£º
/*
* ÔÚij¸öʼþ·¢ÉúʱµÃµ½Í¨Öª£®
*/
public interface InterestingEvent {
¡¡¡¡ public void interestingEvent() ......
´´½¨Ò»¸öÀàµÄʵÀýʱ£¬
1.»áΪËüÒÔ¼°ËüµÄËùÓи¸ÀàµÄʵÀý±äÁ¿·ÖÅäÄÚ´æ¿Õ¼ä£¬Èç¹û·ÖÅä¿Õ¼ä³É¹¦£¬ÔòËùÓÐʵÀý±äÁ¿¶¼»á³õʼ»¯ÎªÄ¬ÈÏÖµ0¡¢false¡¢null
2.»áµÝ¹éµ÷Óø¸¹¹Ô캯Êý£¬µ«ÊÇÔݲ»Ö´Ðй¹Ô캯ÊýµÄÓï¾ä£»
3.¶Ô¸Ã¸¸¹¹Ô캯Êý¶ÔÓ¦µÄÀàµÄʵÀý±äÁ¿¸³Öµ
4.Ö´Ðи¸¹¹Ô캯ÊýµÄÆäËûÓï¾ä
5.¶ÔÓÚ×ÓÀִ࣬ÐÐ2-4²½Öè ......
¼òÑÔÖ®,Èç¹û²»ÓõÚÈý·½ÌṩµÄ½Ó¿Ú
ÄÇ×îºÃµÄ½â¾ö·½°¸Ó¦¸ÃÊǵ±SESSION½¨Á¢Ê±sessionCreated(),ÔÚ·ÃÎÊ×ÜÊýºÍµ±Ç°ÔÚÏßÈËÊýÉÏ+1
µ±SESSIONÏú»ÙʱsessionDistroyed(),ÔÚÏßÈËÊý-1
ºËÐÄ·½·¨ÊÇÀûÓÃListener¼àÌýµÄ¸÷ÖÖ½Ó¿Ú
ÎÒ°Ñ´úÂë(Ö÷Òª²¿·Ö)ÌùÔÚÏÂÃæ
´Ë¶Î´úÂëÎÒÇ××ÔʹÓùý,ûÓÐÎÊÌâ
µ«ÒòΪ¼Ì³ÐÁ˽ӿÚ,ÓÐЩδʹÓõķ½·¨Ò²Òª² ......
Java ½Å±¾ API ¸ÅÊö
½Å±¾ÒýÇæ
½Å±¾ÒýÇæ¾ÍÊÇÖ¸½Å±¾µÄÔËÐл·¾³£¬ËüÄÜÄܹ»°ÑÔËÐÐÆäÉϵĽâÊÍÐÔÓïÑÔת»»Îª¸üµ×²ãµÄ»ã±àÓïÑÔ£¬Ã»Óнű¾ÒýÇ棬½Å±¾¾ÍÎÞ·¨±»ÔËÐС£
Java SE 6 ÒýÈëÁË¶Ô Java Specification Request£¨JSR£©223 µÄÖ§³Ö£¬JSR 223 Ö¼ÔÚ¶¨ÒåÒ»¸öͳһµÄ¹æ·¶£¬Ê¹µÃ Java Ó¦ÓóÌÐò¿ÉÒÔͨ¹ýÒ»Ì׹̶¨µÄ½Ó¿ÚÓë¸÷Öֽű ......