import java.io.File;
import java.io.IOException;
/*采用路径分隔符表示路径*/
public class FileDemo {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
File file = new File("E:"+File.separator+"abc.mp3"); //通过路径分隔符来新建路径
System.out.println("通过路径分隔符新建的文件:"+file.createNewFile());
}
}
import java.io.IOException;
/*采用路径分隔符表示路径*/
public class FileDemo {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
File file = new File("E:"+File.separator+"abc.mp3"); //通过路径分隔符来新建路径
System.out.println("通过路径分隔符新建的文件:"+file.createNewFile());
}
}

本文提供了一个使用Java进行文件操作的简单示例,演示了如何通过路径分隔符创建一个指定路径的文件。
443

被折叠的 条评论
为什么被折叠?



