坑就坑在题目表示不清楚
他的也是是用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();
}
}
}
levn
第 19 级
终于过了,给大家参考一下,题目很坑
已存档
评论 (4)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
元.
30 一月, 02:43
謝謝指點方向
🥰🥰🥰
0
Kou Shikyo
8 十月 2020, 02:41
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
导入的表。
0
楊宗翰
14 七月 2020, 13:09
謝謝 我一開始連題目都看不懂 ....
0
NoobLearner
6 六月 2020, 18:18
谢谢
0