java»ñÈ¡µ±Ç°Â·¾¶[ת]
java»ñÈ¡µ±Ç°Â·¾¶[ת]
¹Ø¼ü×Ö: java ·¾¶
java »ñÈ¡µ±Ç°Â·¾¶
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
Ïà¹ØÎĵµ£º
System.out.println(2|0); //0010 0000 =>0010 = 2
System.out.println(2|1); //0010 0001 =>0011 = 3
System.out.println(3|2); //0011 0010 =>0011 = 3
System.out.println(3&2); //0011 0010 =>0010 = 2
/*
ÔÚjavaÖÐ0´ú±í¼Ù, 1´ú±íÕæ
00011|0010 ´ÓÓÒµ½×ó±È½Ï0|1 = 1, 1|0 = ......
create or replace procedure updateProject is
begin
update project p set p.total_intend_gather =
(select sum(ig.gather_sum) from intend_gather ig where ig.project_number=p.project_number);
up ......
1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getC ......
¹¤³ÌĿ¼½á¹¹ÈçÏ£º
HStudy
--src
--jvm
&nbs ......
һЩjavaÀàÖÐΪʲôÐèÒªÖØÔØ serialVersionUID ÊôÐÔ¡£
ÔÚJavaÖУ¬Èí¼þµÄ¼æÈÝÐÔÊÇÒ»¸ö´óÎÊÌ⣬ÓÈÆäÔÚʹÓõ½¶ÔÏó´®ÐÐÐÔµÄʱºò£¬ÄÇôÔÚijһ¸ö¶ÔÏóÒѾ±»´®Ðл¯ÁË£¬¿ÉÊÇÕâ¸ö¶ÔÏóÓÖ±»Ð޸ĺóÖØÐ²¿ÊðÁË£¬ÄÇôÔÚÕâÖÖÇé¿öÏ£¬ ÓÃÀÏÈí¼þÀ´¶ÁÈ¡ÐÂÎļþ¸ñʽËäÈ»²»ÊÇʲôÄÑÊ£¬µ«ÊÇÓпÉÄܶªÊ§Ò»Ð©ÐÅÏ¢¡£
serialVersionUID À´½â¾öÕâЩΠ......