[ת]Java »ñÈ¡µ±Ç°Â·¾¶&System.getProperty()²ÎÊý´óÈ«
1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð
try{
System.out.println(directory.getCanonicalPath());//»ñÈ¡±ê×¼µÄ·¾¶
System.out.println(directory.getAbsolutePath());//»ñÈ¡¾ø¶Ô·¾¶
}catch(Exceptin e){}
File.getCanonicalPath()ºÍFile.getAbsolutePath()´óÔ¼Ö»ÊǶÔÓÚnew File(".")ºÍnew File("..")Á½ÖÖ·¾¶ÓÐËùÇø±ð¡£
# ¶ÔÓÚgetCanonicalPath()º¯Êý£¬¡°."¾Í±íʾµ±Ç°µÄÎļþ¼Ð£¬¶ø¡±..¡°Ôò±íʾµ±Ç°Îļþ¼ÐµÄÉÏÒ»¼¶Îļþ¼Ð
# ¶ÔÓÚgetAbsolutePath()º¯Êý£¬Ôò²»¹Ü¡±.¡±¡¢¡°..¡±£¬·µ»Øµ±Ç°µÄ·¾¶¼ÓÉÏÄãÔÚnew File()ʱÉ趨µÄ·¾¶
# ÖÁÓÚgetPath()º¯Êý£¬µÃµ½µÄÖ»ÊÇÄãÔÚnew File()ʱÉ趨µÄ·¾¶
±ÈÈ統ǰµÄ·¾¶Îª C:\test £º
File directory = new File("abc");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\test\abc
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\abc
direcotry.getPath(); //µÃµ½µÄÊÇabc
File directory = new File(".");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\test
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\.
direcotry.getPath(); //µÃµ½µÄÊÇ.
File directory = new File("..");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\..
direcotry.getPath(); //µÃµ½µÄÊÇ..
ÁíÍ⣺System.getProperty()ÖеÄ×Ö·û´®²ÎÊýÈçÏ£º
System.getProperty()²ÎÊý´óÈ«
# java.version
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
Ò»¸öʹÓÃÁ˶ÓÁеÄͨÓÃʵÏÖ£º
http://blog.csdn.net/chaosllgao/archive/2009/05/23/4211183.aspx
´ËÎÄÃèÊöÁËÒ»ÖÖ¸ü¼òµ¥µÄÄ£ÐÍ
1. ͬʱֻÓÐ1¸öÉú²úÕߺÍ1¸öÏû·ÑÕß
2. ²»ÓöÓÁУ¬Í¬Ê±Ö»ÓÐÒ»¸ö²úÆ·
3. Éú²úÕßÿ´ÎÉú²ú1¸ö0µ½100Ö®¼äµÄËæ»úÊý£¬Ïû·ÑÕßÔò°Ñ¸ÃËæ»úÊý´òÓ¡³öÀ´¡£Èç¹û²úÉúµÄËæ»úÊýΪ0£¬Ôò ......
ÓÐÈË·´Ó³¿´²»µ½Ô´Â룬·¢ÏÖÊÇCSDNµÄ´úÂë¿Ø¼þÓÐÎÊÌ⡣ϣÍûCSDNºÃºÃ¸Ä½øһϡ£
ÔÝʱÏÈÒÔÎı¾·½Ê½·¢²¼³öÀ´£¬¸ñʽ»á±äÑù¡£
import java.util.LinkedList;
public class ProducerConsumer
{
/**
* @param args
*/
public static void main(String[] args)
{
Queue queue = ......
Vector : »ùÓÚArrayµÄList£¬Æäʵ¾ÍÊÇ·â×°ÁËArrayËù²»¾ß±¸µÄһЩ¹¦ÄÜ·½±ãÎÒÃÇʹÓã¬Ëü²»¿ÉÄÜ×ßÈëArrayµÄÏÞÖÆ¡£ÐÔÄÜÒ²¾Í²»¿ÉÄÜ
³¬Ô½Array¡£ËùÒÔ£¬ÔÚ¿ÉÄܵÄÇé¿öÏ£¬ÎÒÃÇÒª¶àÔËÓÃArray¡£ÁíÍâºÜÖØÒªµÄÒ»µã¾ÍÊÇVector“sychronized”µÄ£¬Õâ¸öÒ²ÊÇVectorºÍ
ArrayListµÄΨһµÄÇø±ð¡£
ArrayList£ºÍ¬VectorÒ»ÑùÊÇÒ»¸ö»ùÓ ......
Calendar ÀàÊÇÒ»¸ö³éÏóÀ࣬ËüΪÌض¨Ë²¼äÓëÒ»×éÖîÈç YEAR¡¢MONTH¡¢DAY_OF_MONTH¡¢HOUR µÈ ÈÕÀú×Ö¶ÎÖ®¼äµÄת»»ÌṩÁËһЩ·½·¨£¬²¢Îª²Ù×÷ÈÕÀú×ֶΣ¨ÀýÈç»ñµÃÏÂÐÇÆÚµÄÈÕÆÚ£©ÌṩÁËһЩ·½·¨¡£Ë²¼ä¿ÉÓúÁÃëÖµÀ´±íʾ£¬ËüÊǾàÀúÔª£¨¼´¸ñÁÖÍþÖαê׼ʱ¼ä 1970 Äê 1 Ô 1 ÈÕµÄ 00:00:00.000£¬¸ñÀï¸ßÀûÀú£©µÄÆ«ÒÆÁ¿¡£
Àý:
Calenda ......