java»ñµÃwindowsϵͳʱ¼äÓÐÎóµÄ½â¾ö·½°¸
java»ñµÃwindowsϵͳʱ¼äÓÐÎóµÄ½â¾ö·½°¸
½ñÌìÓöµ½ÁËÒ»¸öºÜÆæ¹ÖµÄÎÊÌ⣬¾ÍÊÇÀûÓûñȡϵͳµ±Ç°Ê±¼äµÄʱºò£¬×ÜÊÇÓëʵ¼ÊµÄʱ¼äÏà²î8¸öСʱ£¬Ê®·ÖÓôÃÆ¡£
ÎÞÂÛÊÇʹÓÃ
Calendar c=Calendar.getInstance();
SimpleDateFormat f=new SimpleDateFormat("yyyyÄêMMÔÂddÈÕ HHʱmm·ÖssÃë");
System.out.println(f.format(c.getTime()));
»¹ÊÇʹÓÃ
String pattern = "yyyy-MM-DD HH:mm:ss";
SimpleDateFormat df = new SimpleDateFormat(pattern);
Date today = new Date();
System.out.println(df.format(today));
»ñµÃµÄʱ¼ä¶¼ÊÇÓëwindowsϵͳµÄʱ¼äÏà²î8¸öСʱ£¬ºóÀ´Í¨¹ý²éÔÄÏà¹Ø×ÊÁÏ£¬ÊÇÓÉÓÚÎÒÔÚ»ñȡʱ¼äµÄʱºòûÓÐÖ¸¶¨Ê±Çø£¬ÓÚÊÇÉèÖÃÁËһϣ¬¹þ¹þ£¬ÖÕÓÚ½â¾öÁË£¡
½â¾ö·½·¨ÓÐÁ½¸ö£¬·Ö±ðÊÇ£º
·½·¨Ò»£º
public String getFormatedDateString(int timeZoneOffset)
if (timeZoneOffset > 13 || timeZoneOffset < -12) {
timeZoneOffset = 0;
}
&
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
½ñÌì·¢ÏÖÒ»¸öºÜNBµÄÍæÒ⣬ÈÃÎÒÃÇÔÚ¿ª·¢µÄʱºòÐÞ¸ÄJavaÎļþ£¬²»ÓÃÖØÆô·þÎñÆ÷Á¢¿ÌÉúЧ£¡Ö§³ÖJetty tomcat jbossµÈºÜ¶à·þÎñÆ÷£¬Ëü¾ÍÊÇJRebel¡£ http://www.zeroturnaround.com/jrebel/installation/ ÕâÀïÓÐÕë¶Ô²»Í¬·þÎñÆ÷µÄ°²×°·½·¨£¬»ù±¾ÉÏÖ÷Á÷µÄ¶¼º¸ÇÁË£¬¾ø´ó¶àÊý³ÌÐòÔ±¶¼ÄÜʹÓã¡ÎÒÃǹ«Ë¾ÓÃmaven/jetty¶ÔÏîÄ¿½øÐй¹½¨ºÍ¿ª ......
¹ØÓÚ¾ø¶Ô·¾¶ºÍÏà¶Ô·¾¶£º
¾ø¶Ô·¾¶¾ÍÊÇÄãµÄÖ÷Ò³ÉϵÄÎļþ»òĿ¼ÔÚÓ²ÅÌÉÏÕæÕýµÄ·¾¶£¬(URLºÍÎïÀí·¾¶)ÀýÈ磺C:xyz est.txt ´ú±íÁËtest.txtÎļþµÄ¾ø¶Ô·¾¶¡£http://www.sun.com/index.htmÒ²´ú±íÁËÒ»¸öURL¾ø¶Ô·¾¶¡£Ïà¶Ô·¾¶£ºÏà¶ÔÓëij¸ö»ù׼Ŀ¼µÄ·¾¶¡£°üº¬WebµÄÏà¶Ô·¾¶£¨HTMLÖеÄÏà¶ÔĿ¼£©£¬ÀýÈ磺ÔÚServletÖУ¬" ......
Java·ÃÎÊȨÏÞÒ»¹²ÓÐËÄÖÖ£¬ËûÃÇÖ®¼äµÄ·ÃÎÊȨÏޱȽÏͨ¹ýÒÔÏÂÒ»×éÀý×ÓÀ´½âÊÍ
Àý×Ócode£ºModiferDemo.java
package com.glust.blog.j2se;
public class ModiferDemo{
//ËÄÖÖ·ÃÎÊȨÏ޵ıäÁ¿£¨ÊôÐÔ£©
private int a;
int b;//friendly
protected int c;
public int d;
......
JAVAÅÅÐò»ã×Ü ÊÕ²Ø
package com.softeem.jbs.lesson4;
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
* 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£ ......