Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÇëÉ÷ÓÃjavaµÄFile#renameTo(File)·½·¨

ÒÔǰÎÒÒ»Ö±ÒÔΪFile#renameTo(File)·½·¨ÓëOSÏÂÃæµÄ move/mv ÃüÁîÊÇÏàͬµÄ£¬¿ÉÒÔ´ïµ½¸ÄÃû¡¢Òƶ¯ÎļþµÄÄ¿µÄ¡£²»¹ýºóÀ´¾­³£·¢ÏÖÎÊÌ⣺File#renameTo(File)·½·¨»á·µ»ØÊ§°Ü(false)£¬ÎļþûÓÐÒÆ¶¯£¬Óֲ鲻³öÔ­Òò£¬ÔÙºóÀ´¸É´àÆúÓø÷½·¨£¬×Ô¼ºÊµÏÖÒ»¸öcopy·½·¨£¬ÎÊÌâµ¹ÊÇÔÙҲûÓгöÏÖ¹ý¡£
×òÌìÀϰåͬѧÓÖÓöµ½Õâ¸öÎÊÌ⣬File#renameTo(File)·½·¨ÔÚwindowsÏÂÃæ¹¤×÷µÄºÃºÃµÄ£¬ÔÚlinuxÏÂż¶ûÓÖʧÁéÁË¡£»Øµ½¼ÒÎÒɨÁËÒ»±éJDKÖÐFile#renameTo(File)·½·¨µÄÔ´´úÂ룬·¢ÏÖËüµ÷ÓõÄÊÇÒ»¸ö±¾µØµÄ·½·¨(native method)£¬ÎÞ·¨ÔÙ¸ú×ÙÏÂÈ¥¡£ÍøÉÏÓÐÈË˵¸Ã·½·¨ÔÚwindowÏÂÊÇÕý³£µÄ£¬ÔÚlinuxÏÂÃæÊDz»Õý³£µÄ¡£Õâ¸öºÜÄÑ˵ͨ£¬SUN²»¿ÉÄܸã³öÕâÖÖÆ½Ì¨²»Ò»ÖµĴúÂë³öÀ´°¡¡£
ºóÃæÔÚSUNµÄ¹Ù·½ÂÛ̳ÉÏ¿´µ½ÓÐÈËÌáµ½Õâ¸öÎÊÌâ“works on windows, don't work on linux”£¬ºóÃæÓÐÈ˻ظ´ËµÊÇ“file systems”²»Ò»Ñù¡£¾¿¾¹Ôõô²»Ò»ÑùÄØ£¿»¹ÊÇûÓÐÏë³öÀ´...
ºóÃæÔÚÒ»¸öÂÛ̳ÀïÃæ·¢ÏÖÁËijÈ˹ØÓÚÕâ¸öÎÊÌâµÄ²ûÊö£º
ÒýÓÃ
In the Unix'esque O/S's you cannot renameTo() across file systems. This behavior is different than the Unix "mv" command. When crossing file systems mv does a copy and delete which is what you'll have to do if this is the case.
The same thing would happen on Windows if you tried to renameTo a different drive, i.e. C: -> D:
ÖÕÓÚÃ÷°×¿©¡£
×ö¸öʵÑ飺
Java´úÂë
  
File sourceFile = new File("c:/test.txt");   
File targetFile1 = new File("e:/test.txt");   
File targetFile2 = new File("d:/test.txt");   
System.out.println("source file is exist? " + sourceFile.exists()   
    + ", source file => " + sourceFile);   
System.out.println(targetFile1 + " is exist? " + targetFile1.exists());   
System.out.println("rename to " + targetFile1 + " => "  
    + sourceFile.renameTo(targetFile1));   
System.out.pr


Ïà¹ØÎĵµ£º

javaÖÐÈçºÎʹÓÃamcharts


×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......

javaʹÓÃjdbcÁ¬½Ó¸÷ÖÖÊý¾Ý¿â

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= Dri ......

Java±ÊÊÔÃæÊÔÌâ


1¡¢Êý¾Ý¿âÐÔÄÜÓÅ»¯ÓÐÄÇЩ´ëÊ©£¨ORACLE/SYBASE/DB2/SQLSERVERѡһÖÖ£©2¡¢Ð´Ò»¸ö³ÌÐò£¬°Ñ×Ö·û´®µ¹Ðð£¬ÒªÇó“ÄãºÃѽ”±äΪ“ѽºÃÄ㔣¨´¦ÀíÖÐÎÄ£©3¡¢Ãû´Î½âÊÍ£¨¼Ì³Ð¡¢ÖØÔØ¡¢½Ó¿Ú£©4¡¢JAVAÏß³ÌʵÏÖÓÐÄÇЩ·½·¨£¬ËµÃ÷Ö®5¡¢JAVAÄÚ´æÒÅ©ʲôԭÒò6¡¢´ÓÏîÄ¿¹ÜÀí½Ç¶È·ÖÎöÐèÇó±ä¶¯µÄ¿ØÖÆ7¡¢JAVA SERVLETµÄÉ ......

¸´Ï°¡¶Thinking in Java¡·±Ê¼Ç¶þ:µÚ¾Å¡¢Ê®Õ±ʼÇ

1.½Ó¿ÚµÄ·½·¨Ä¬È϶¼ÊÇpublic µÄ£¬·½·¨Ö»ÄÜÊÇpublic&abstract,·½·¨µÄʵÏÖ²»ÄÜСÓÚ½Ó¿Ú·½·¨µÄvisibality.
    ½Ó¿ÚÖеÄÓòĬÈÏÊÇpublic static finalµÄ¡£
  Ò»¸öÀà¿ÉÒÔʵÏֺܶà¸ö½Ó¿Ú¡£
2.ÄÚ²¿Àà¾ßÓÐÍâΧÀࣨenclosing class£©µÄËùÓÐÔªËØµÄ·ÃÎÊȨ¡£
3.ÄäÃûÀàÈç¹ûÏ£ÍûÊÇÓÐÒ»¸öÔÚÆäÍⲿ¶¨ÒåµÄ¶ÔÏó£¬ ......

java ÑéÖ¤Éí·ÝÖ¤ Éí·ÝÖ¤javaÑéÖ¤

ÒýÓÃÓÚ£ºhttp://blog.csdn.net/hhzxj2008/archive/2010/01/10/5171444.aspx
public static boolean validatePersonalId(String personalId) {

if ((personalId == null) || ((personalId.length() != 15) &&
(personalId.length() != 18))) {
return ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ