JavaʱÇøbug£¬TimeZone.setDefault()Ö»ÔÚµ±Ç°Ïß³ÌÓÐЧ
ÏîÄ¿ÊÇ»ùÓÚGMTʱ¼äµÄ£¬ÔÚϵͳÆô¶¯µÄʱºò£¬ÎÒÃǾͻáµ÷ÓÃTimeZone.setDefault(timeZone)½«Ä¬ÈÏʱÇøÉèΪGMT¡£
ºóÀ´Í»È»·¢ÏÖ£¬ÓÐʱÓû§Ñ¡ÔñµÄʱ¼ä¾¹ýºǫ́һȦºó»Ø²úÉú8¸öСʱÎó²î¡£ÓÖÊǼäЪÐԵģ¬ÒªËûÖØÏÖµÄʱºòÓÖÆ«²»À´¡£¿àÐÄdebug£¬ÖÕÓÚ·¢ÏÖÔÚ²¿·ÖÏß³ÌÖУ¬Ê±Çø»¹ÊÇGMT+8£¬ºǫ́ij¸öµ÷ÓÿÉÄÜ°ÑʱÇø±äΪÁËGMT£¬8СʱÎó²î¾Í²úÉúÁË¡£ÍøÉÏÒ»ËÑ£¬ÔÀ´ÊÇbug£º
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6352812
Ö»ÔÚ²¿·ÖµçÄÔÉÏÓÐÎÊÌ⣬ÐÒºÃproductionÉÏÊǺõģ¬Ð´ÁËÒ»¸ö³ÌÐòÀ´²âÊÔ£º
import java.util.Date;
import java.util.TimeZone;
public class Test {
@SuppressWarnings("unused")
public static void main(String[] args) throws InterruptedException {
DateThread thread = new DateThread();
thread.start();
TimeZone gmt = TimeZone.getTimeZone("GMT");
Date now = new Date();
System.out.println("main thread,before set timezone:" + now.toString());
TimeZone.setDefault(gmt);
Thread.currentThread().sleep(2000);
thread.resume();
System.out.println("main thread,after set timezone:" + now.toString());
}
}
class DateThread extends Thread {
@SuppressWarnings( { "unused", "deprecation" })
public void run() {
Date now = new Date();
System.out.println("sub thread,before set timezone:" + now.toString());
this.suspend();
System.out.println("sub thread,after set timezone:" + now.toString());
}
}
Èç¹û×ÓÏß³ÌÊä³öµÄʱÇøÒ»Ñù£¬¾Í˵Ã÷ÓÐbug
Ïà¹ØÎĵµ£º
JavaÖжÑÕ»µÄ¸ÅÄȻÊÇÂß¼Éϵģ¬ÔÚÍêÈ«·ûºÏJava¹æ·¶µÄJava´¦ÀíÆ÷ÃæÊÀ֮ǰ£¬ËùÓÐJavaÐéÄâ»úÌṩµÄÄÚÈݶ¼ÊÇÓÉÈí¼þÄ£Äâ³öÀ´µÄ¡£
ʲô½Ð¶Ñ£¿ÄãÓÃÊ®¼¸¸öÂ齫ÅÆÊúÖ±µþ³ÉÒ»ÞûÕâ½Ð¶Ñ£¬Äã¿ÉÒÔ´ÓÉÏÃæ¡¢ÏÂÃæ¡¢ÖмäÈÎÒâ³é³öÒ»ÕÅÅÆ£¬Ò²¿ÉÒÔÈÎÒâ²åÈëÒ»ÕÅ¡£
ʲô½ÐÕ»£¿AK-47µÄµ¯Ï»¾ÍÊÇÒ»¸öÕ»£¬ÔÚÉÏÃæµÄ×Óµ¯Ã»±»È¡³ö֮ǰ£¬ÄãÎÞ·¨È¡³öÏÂà ......
ÐèÒª×öÒ»¸ö×ÀÃæµÄС¶«Î÷£¬ÓÉÓÚÖÁ½ñΪֹֻ»áдJava£¬ËùÒÔÖ»ÓÐÓÃswingÀ´×öÁË¡£ÅóÓÑ˵Delphi×öÆðÀ´ºÜ¿ì£¬µ«ÎÒûʱ¼äȥѧÁË£¬Ò»¶¨Òª¿ªÊ¼ºáÏò·¢Õ¹ÁË¡£
ÔÀ´¶ÌÔݵÄ×ö¹ýNetBeansµÄrcp¿ª·¢£¬µ«ËüµÄ´úÂë×éÖ¯Óеã¹ýÓÚ¸´ÔÓ£¬²»¹ýÎÒÒª×öµÄ²»ÊǺܴóµÄ¶«Î÷£¬µ«»¹ÊÇÏëÏÈÕÒEclips ......
ÍøÕ¾ÁбíÈçÏ£º
IBMÖйúµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/java/ ÖÐÎÄ
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/java Ó¢ÎÄ
Google´úÂëĿ¼ÍøÕ¾£ºhttp://c ......
Java±àдһ¸öº¯Êý½»»»Á½¸ö±äÁ¿µÄÖµ
Javaº¯ÊýÔÚ´«µÝ¹ý³ÌÖÐÖ»Äܹ»´«Öµ£¬²»ÄÜ´«Ö·¡£ÕâÑù£¬º¯ÊýµÄ²ÎÊýÔÚº¯ÊýÄÚ²¿×öÈκα仯¾Í¶¼²»»á·´Ó³µ½Íⲿµ÷ÓÃÕßÀ´¡£ËùÒÔ½â¾öÖ®µÀ¾ÍÊÇÒªÕÒµ½Òª½»»»¶ÔÏóµÄÒýÓ᣶ÔÓÚÆÕͨµÄÖµÀàÐÍ£¬Ïñint»òÕßdoubleÕâÑùµÄ¿ÉÒԸĴ«ËûÃǵİü×°ÀàIntegerºÍDouble¡£¶ø¶ÔÓÚ±¾À´¾ÍÊÇÒýÓÃÀàÐ͵ĶÔÏó£¬ÔòÐèÒª¶ÔËûÃÇÔÙ ......