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
Ïà¹ØÎĵµ£º
ÓëÃÕÌâ26ÖеijÌÐòÒ»Ñù£¬ÏÂÃæµÄ³ÌÐòÒ²°üº¬ÁËÒ»¸ö¼Ç¼ÔÚÖÕֹǰÓжàÉٴεü´úµÄÑ»·¡£ÓëÄǸö³ÌÐò²»Í¬µÄÊÇ£¬Õâ¸ö³ÌÐòʹÓõÄÊÇ×óÒÆ²Ù×÷·û£¨<<£©¡£ÄãµÄÈÎÎñÕÕ¾ÉÊÇÒªÖ¸³öÕâ¸ö³ÌÐò½«´òӡʲô¡£µ±ÄãÔĶÁÕâ¸ö³ÌÐòʱ£¬Çë¼Çס Java ʹÓõÄÊÇ»ùÓÚ2µÄ²¹ÂëµÄ¶þ½øÖÆËãÊõÔËË㣬Òò´Ë-1ÔÚÈκÎÓзûºÅµÄÕûÊýÀàÐÍÖУ¨byte¡¢short¡¢int»òlong£ ......
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 ......
ÇëÌṩһ¸ö¶ÔiµÄÉùÃ÷£¬½«ÏÂÃæµÄÑ»·×ª±äΪһ¸öÎÞÏÞÑ»·£º
while (i != 0) {
i >>>= 1;
}
»ØÏëһϣ¬>>>=ÊǶÔÓ¦ÓÚÎÞ·ûºÅÓÒÒÆ²Ù×÷·ûµÄ¸³Öµ²Ù×÷·û¡£0±»´Ó×óÒÆÈëµ½ÓÉÒÆÎ»²Ù×÷¶ø¿Õ³öÀ´µÄλÉÏ£¬¼´Ê¹±»ÒÆÎ»µÄ¸ºÊýÒ²ÊÇÈç´Ë¡£
Õâ¸öÑ»·±ÈÇ°ÃæÈý¸öÑ»·ÒªÉÔ΢¸´ÔÓÒ»µã£¬ÒòΪÆäÑ»·Ìå·Ç¿Õ¡£ÔÚÆäÑ»·ÌâÖУ¬ ......
Web Service¸ÅÊö
ʲôÊÇWeb Service
Web ServiceÊÇÄܹ»»ùÓÚÍøÂ磬ÓÈÆäÊÇ»ùÓÚÍòÎ¬Íø£¨World Wide
Web£©Ö±½Óµ÷ÓõÄÄܹ»´¦ÀíÀëÉ¢ÈÎÎñ»òÁ¬ÐøÈÎÎñµÄÈí¼þÄ£ÐÍ¡£Ä¿Ç°½ÏΪÁ÷ÐеÄÓ¦ÓÃÊÇ£¬ÓÉÒ»¼Ò¹«Ë¾¶ÔÆäרÓÐÊý¾Ý½øÐзâ×°£¬ÌṩWeb
Service£¬È»ºóÆäËü¹«Ë¾¾Í¿ÉÒÔͨ¹ýInternetÀ´¶¯Ì¬Ê¹ÓÃÕâÐ ......
ÓëÃÕÌâ26ºÍ27ÖеijÌÐòÒ»Ñù£¬ÏÂÃæµÄ³ÌÐòÓÐÒ»¸öµ¥ÖصÄÑ»·£¬Ëü¼Ç¼µü´úµÄ´ÎÊý£¬²¢ÔÚÑ»·ÖÕֹʱ´òÓ¡Õâ¸öÊý¡£ÄÇô£¬Õâ¸ö³ÌÐò»á´òÓ¡³öÊ²Ã´ÄØ£¿
public class Count {
public static void main(String[] args) {
final int START = 2000000000;
int count = 0;
for (float f = START; f < S ......