复制文件异常处理,3种方式(JDK9、JDK7、标准)
package glj10;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class ExceptionDemo {
public static void main(String[] args) {
}
//JDK9的改进方案
public static void method2() throws IOException{
FileReader fr = new FileReader("e://share//java.txt");
FileWriter fw = new FileWriter("E://share//java111.txt");
try(fr;fw){
char[] chs = new char[1024];
int len;
共有 0 条评论