JAVA²Ù×÷Îļþ£¨´´½¨¡¢É¾³ý¡¢¸´ÖÆ¡¢¼ôÇУ©
package fileTest;
import java.io.*;
public class FileOperate {
public FileOperate() {
}
public static void main(String args[]){
// newFolder("D:/100");
moveFile("e:/9787030230621-tu06110101(sq) 1.pdf","d:/9787030230621-tu06110101(sq) 1.pdf");
}
/**
* н¨Ä¿Â¼
* @param folderPath String Èç c:/fqf
* @return boolean
*/
public static void newFolder(String folderPath) {
try {
String filePath = folderPath;
filePath = filePath.toString();
java.io.File myFilePath = new java.io.File(filePath);
if (!myFilePath.exists()) {
myFilePath.mkdir();
}
}
catch (Exception e) {
System.out.println("н¨Ä¿Â¼²Ù×÷³ö´í");
e.printStackTrace();
}
}
/**
* н¨Îļþ
* @param filePathAndName String Îļþ·¾¶¼°Ãû³Æ Èçc:/fqf.txt
* @param fileContent String ÎļþÄÚÈÝ
* @return boolean
*/
public static void newFile(String filePathAndName, String fileContent) {
Ïà¹ØÎĵµ£º
¹¤³ÌĿ¼½á¹¹ÈçÏ£º
HStudy
--src
--jvm
&nbs ......
ÄÇÌì°á¼ÒµÄʱºò²Å·¢ÏÖÓкܶàµÄ¶«Î÷£¬»¹¼ÇµÃÎÒ¸ÕÀ´µ½±±¾©µÄʱºòÕÒÁË·¿×Ó¾ÍһֱסÔÚÕâÀï¡£¿ªÊ¼Ã¦Âµ×ÅÕÒ¹¤×÷¡£ÕÒµ½Õâ·Ý¹¤×÷µÄʱºò±¾À´ÊÇÏë»»×ÅÄØ£¬Ã¿Ì춼ÊÇ×öһЩÎÄ×Ö¼ÈëµÄ¹¤×÷·¢³îµÄÎÒ£¬²»¹ýÔÚÕâÀïÒ²ÊÇÓз¢Õ¹µÄ»ú»á£¬ÓеÄʱºòÕûÀíһЩ¹ØÓÚÊý¾Ý·½ÃæµÄ£¬ÈÃÐÂÀ´µÄ°ÑÊý¾Ý¼Èëµ½µçÄÔÉÏ£¬ÎÒÃÇÒ²ÊÇ×öÍâ°üµÄ¡£µ«Ê ......
java»ñÈ¡µ±Ç°Â·¾¶[ת]
¹Ø¼ü×Ö: java ·¾¶
java »ñÈ¡µ±Ç°Â·¾¶
1 ¡¢ÀûÓà System.getProperty() º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dir Ö¸¶¨Á˵±Ç°µÄ·¾¶
2 ¡¢Ê¹Óà File ÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");// É趨Ϊµ±Ç°Îļþ ......
thisµÄÓ÷¨ÔÚjavaÖдóÌå¿ÉÒÔ·ÖΪ3ÖÖ£º
//1.ÆÕͨµÄÖ±½ÓÒýÓÃ
class test {
private int x,y;
public test(int x,int y) {
setX(x);//Ò²¿ÉÒÔдΪthis.setX(x);ÕâÖÖÇé¿öÏÂthis¿ÉÒÔÊ¡ÂÔ.
}
}
//2.·½·¨ÖеÄij¸öÐβÎÃûÓ뵱ǰ¶ÔÏóµÄÄ ......
public static void main(String[] args)
{
Integer[] arrInt = new Integer[6];
arrInt[0] = 123;
arrInt[1] = 3453;
arrInt[2] = 345;
arrInt[3] = 23;
arrInt[4] = 11;
arrInt[5] = 345;
int temp = 0;
for (int i ......