永发信息网

怎么把txt文件第一行赋值给n

答案:1  悬赏:40  手机版
解决时间 2021-04-04 17:53
  • 提问者网友:寂寞梧桐
  • 2021-04-04 02:17
怎么把txt文件第一行赋值给n
最佳答案
  • 五星知识达人网友:鱼忧
  • 2021-04-04 03:13
File f = new File("d://test.txt");
BufferedReader is;
try {
is = new BufferedReader(new FileReader(f));
int n=Integer.valueOf(is.readLine());
System.out.println(n);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯