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

Java Timer ¶ÔÏó´´½¨ºóʹÓÃTimer¸ü¸ÄÆäÊôÐÔ!!!

Ê×ÏÈÀ´¸ö¼òµ¥ÄǵÄʵÀý:
package cn.vicky;
import java.util.Timer;
import java.util.TimerTask;
public class MyTimer {

private int i = 1;

private void change(long time){
System.out.println("one : " + i);
final Timer timer = new Timer();
timer.schedule(new TimerTask(){
@Override
public void run() {
System.out.println("run " + i++);
if (i != 5) {
timer.cancel();
}
}

}, 10000,1);
System.out.println("two : " + i);
}
public static void main(String[] args) {
MyTimer mytimer = new MyTimer();
mytimer.change(0);
}
}

ÎÒÃÇÒÔÒ»¸öʵÀý˼¿¼,³µÕ¾,ÿÁ¾³µÖ»ÄÜÍ£¿¿10·ÖÖӾͱØÐë³öÕ¾.´«Í³·½Ê½,ÎÒÃÇÊÇÒÔ³µÕ¾Îªµ¥Î»,ͨ¹ý¶àÏß³ÌÀ´¿ØÖÆÃ¿Á¾³µµÄ³öÕ¾Çé¿ö!
package cn.vicky;
import java.util.Date;
/**
*
* @author Vicky
* ¹«½»Æû³µ
*/
public class Bus {

private String name = "";

private boolean inStation = true;
/**
* ¹«½»Æû³µÔÚ³µÕ¾ÖÐÖ»¿ÉÄÜ´ô10·ÖÖÓ,È»ºó¹«½»¾Í¿ª×ß,Ïà¶ÔÓÚ¹«½»³µÕ¾,¹«½»10·ÖÖÓºó¾ÍΪ¿Õ!
*/
public Bus(String carName) {
this.name = carName;
System.out.println(new Date() + " : a car["+ name +"] into the bus station !");
}
public void setInStation(boolean inStation) {
this.inStation = inStation;
}
public boolean isInStation() {
return inStation;
}

public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Bus other = (Bus) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return "Bus [" + name + "] :: " + (inSta


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

IBM FileNet Content Java API ¼ò½é

2008 Äê 6 ÔÂ 24 ÈÕ
Ô­ÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄî£¬ËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......

Java Native Method[»¹Ã»À´µÃ¼°·­Òë]

The goal for this chapter is to introduce you to Java's native methods. If you are new to Java, you may not know what native methods are, and even if you are an experienced Java developer, you may not have had a reason to learn more about native methods. At the conclusion of this chapter you should ......

Java½â»ó3 29Ñ­»·ÕßµÄÐÂÄï

ÇëÌṩһ¸ö¶ÔiµÄÉùÃ÷£¬½«ÏÂÃæµÄÑ­»·×ª±äΪһ¸öÎÞÏÞÑ­»·£º
while (i != i) {
}
Õâ¸öÑ­»·¿ÉÄܱÈǰһ¸ö»¹ÒªÊ¹È˸е½À§»ó¡£²»¹ÜÔÚËüÇ°Ãæ×÷ºÎÖÖÉùÃ÷£¬Ëü¿´ÆðÀ´È·ÊµÓ¦¸ÃÁ¢¼´ÖÕÖ¹¡£Ò»¸öÊý×Ö×ÜÊǵÈÓÚËü×Ô¼º£¬¶ÔÂð£¿
¶Ô£¬µ«ÊÇIEEE 754¸¡µãËãÊõ±£ÁôÁËÒ»¸öÌØÊâµÄÖµÓÃÀ´±íʾһ¸ö²»ÊÇÊý×ÖµÄÊýÁ¿[IEEE 754]¡£Õâ¸öÖµ¾ÍÊÇNaN£¨“ ......

Java½â»ó3 33Ñ­»·ÕßÓöµ½ÁËÀÇÈË

ÇëÌṩһ¸ö¶ÔiµÄÉùÃ÷£¬½«ÏÂÃæµÄÑ­»·×ª±äΪһ¸öÎÞÏÞÑ­»·¡£Õâ¸öÑ­»·²»ÐèҪʹÓÃÈκÎ5.0°æµÄÌØÐÔ£º
while (i != 0 && i == -i) {
}
ÕâÈÔÈ»ÊÇÒ»¸öÑ­»·¡£ÔÚ²¼¶û±í´ïʽ(i != 0 && i == -i)ÖУ¬Ò»Ôª¼õºÅ²Ù×÷·û×÷ÓÃÓÚi£¬ÕâÒâζ×ÅËüµÄÀàÐͱØÐëÊÇÊý×ÖÐ͵ģºÒ»Ôª¼õºÅ²Ù×÷·û×÷ÓÃÓÚÒ»¸ö·ÇÊý×ÖÐͲÙ×÷ÊýÊÇ·Ç·¨µÄ¡£Òò´Ë£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ