FileInputStream简单问题
import java.io.*;public class niu{ public static void main(String[] args) { String path="e:/insert.c"; File fs=new File(path); System.out.println(fs.getName());//正常输出insert.c FileInputStream fis = new FileInputStream(fs);//为什么此处会抛出异常java.io.FileNotFoundException }}
import java.io.File;import java.io.FileInputStream;import java.io.IOException;public class MyTest { public static void main(String[] args){ String path="e:\\insert.c"; //String path="e:\\insert.txt";如果.c文件找不到,试一下换成insert.txt File fs=new File(path); System.out.println(fs.getName());//正常输出insert.c try{ FileInputStream fis = new FileInputStream(fs); }catch(IOException e){ e.printStackTrace(); } }}