坑就坑在题目表示不清楚 他的也是是用BufferedReader 来读取文件名字 然后只用InputStream 读文件 不要加任何wrapper public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); InputStream inputStream = null; try { String name = reader.readLine(); File file = new File(name); inputStream = new FileInputStream(file); int size = inputStream.available(); byte[] array = new byte[size]; inputStream.read(array); String result = new String(array); System.out.print(result); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { reader.close(); inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } }