【swallowed】java作业写首歌曲output如下Therewasanoldwomanwhoswallowedafly...
答案:2 悬赏:80 手机版
解决时间 2021-02-03 04:55
- 提问者网友:姑娘长的好罪过
- 2021-02-02 06:38
【swallowed】java作业写首歌曲output如下Therewasanoldwomanwhoswallowedafly...
最佳答案
- 五星知识达人网友:琴狂剑也妄
- 2021-02-02 06:56
【答案】 1,最最简单就是
System.out.println("There was an old woman who swallowed a fly.");
System.out.println("I don't know why she swallowed that fly,");
以此类推
2,
将以上歌词存入a.txt文件,以放到e盘为例子.
import java.io.*;class A{public static void main(String[] args) throws IOException{File f=new File("e:/a.txt");FileInputStream fis=new FileInputStream(f);File f1=new File("e:/out.txt");FileOutputStream fos=new FileOutputStream(f1);byte[] b=new byte[32];int hasRead;while((hasRead=fis.read(b))>0){//输出到一个文件中fos.write(b,0,hasRead);//输出到控制台System.out.print(new String(b,0,hasRead));}fis.close();fos.close();}}
System.out.println("There was an old woman who swallowed a fly.");
System.out.println("I don't know why she swallowed that fly,");
以此类推
2,
将以上歌词存入a.txt文件,以放到e盘为例子.
import java.io.*;class A{public static void main(String[] args) throws IOException{File f=new File("e:/a.txt");FileInputStream fis=new FileInputStream(f);File f1=new File("e:/out.txt");FileOutputStream fos=new FileOutputStream(f1);byte[] b=new byte[32];int hasRead;while((hasRead=fis.read(b))>0){//输出到一个文件中fos.write(b,0,hasRead);//输出到控制台System.out.print(new String(b,0,hasRead));}fis.close();fos.close();}}
全部回答
- 1楼网友:你哪知我潦倒为你
- 2021-02-02 08:15
我也是这个答案
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯