Java File ?????÷??????
???????????? ???????[ 2015/7/17 13:31:59 ] ????????????????
????Java File????????????????Java????????????????????е?????????????Java File??????????????????????????File???е???÷??????м?????????????Java??????????????
??????????
????public class FileDemo
????{
????public static void main(String[] args)
????{
????//??????File(String pathname)
????File f1 =new File("c:\abc\1.txt");
????//File(String parent??String child)
????File f2 =new File("c:\abc"??"2.txt");
????//File(File parent??String child)
????File f3 =new File("c:"+File.separator+"abc");//separator ????????
????File f4 =new File(f3??"3.txt");
????System.out.println(f1);//c:abc1.txt
????}
????}
????????????
????1.boolean createNewFile() ?????????true ???????false
????2.boolean mkdir() ??????
????3.boolean mkdirs() ????????
???????????
????1.boolean delete()
????2.boolean deleteOnExit() ?????????????
????import java.io.File;
????import java.io.IOException;
????public class FileDemo2 {
????public static void main(String[] args){
????File f =new File("d:\1.txt");
????try {
????System.out.println(f.createNewFile());//??????????????false
????System.out.println(f.delete());//????????????????false
????} catch (IOException e) {
????// TODO Auto-generated catch block
????e.printStackTrace();
????}
????}
????}
?????ж????
????1.boolean canExecute()?ж???????????
????2.boolean canRead()?ж?????????
????3.boolean canWrite() ?ж????????д
????4.boolean exists() ?ж??????????
????5.boolean isDirectory()
????6.boolean isFile()
????7.boolean isHidden()
????8.boolean isAbsolute()?ж??????·?? ?????????????ж?
???????????
????1.String getName()
????2.String getPath()
????3.String getAbsolutePath()
????4.String getParent()//?????и???????null
????5.long lastModified()//???????????????
????6.long length()
????7.boolean renameTo(File f)
????8.File[] liseRoots()//??????????
????9.String[] list()
????10.String[] list(FilenameFilter filter)
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11