首页 新闻 会员 周边

(1)(2)空应该填什么?

0
悬赏园豆:10 [已解决问题] 解决于 2022-12-15 19:16

将程序补充完整,程序的功能是:将E盘文件FileDemo.java内容,显示控制台。

import java.io.FileInputStream;
public class FileDemo {
public static void main(String args[]) {
byte[] buf=new byte[2056];
try{
FileInputStream fileIn=(1)
int bytes=
_______(2)
String str=new String(buf,0,bytes);
System.out.println(str);
}
catch(Exception e){
e.printStackTrace();
}
}
}

peir的主页 peir | 初学一级 | 园豆:105
提问于:2022-12-15 14:32
< >
分享
最佳答案
0
import java.io.FileInputStream;
public class FileDemo {
public static void main(String args[]) {
byte[] buf=new byte[2056];
try{
FileInputStream fileIn=new FileInputStream("E:\FileDemo.java");
int bytes=fileIn.read(buf);
String str=new String(buf,0,bytes);
System.out.println(str);
}
catch(Exception e){
e.printStackTrace();
}
}
}
收获园豆:10
不苦 | 初学一级 |园豆:20 | 2022-12-15 16:52

谢谢!

peir | 园豆:105 (初学一级) | 2022-12-15 19:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册