A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© nsunshine 中级黑马   /  2014-7-9 10:28  /  1107 人查看  /  5 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文


import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo
{
public static void main(String[]args) throws IOException
{
        FileInputStream fis = new FileInputStream(c:\\1.mp3);
        FileOutputStream fos = new FileOutputStream(c:\\2.mp3);
        int ch = 0;
        while((ch = fis.read())!=-1)
        {
                fos.write(ch);
        }
        fos.close();
        fis.close();
       
}
}

5 个回复

倒序浏览
没错,你加上“”就可以了
FileInputStream fis = new FileInputStream("c:\\1.mp3")
FileOutputStream fos = new FileOutputStream("c:\\2.mp3");
回复 使用道具 举报
FileInputStream fis = new FileInputStream("所在地址要用引号括起来");
回复 使用道具 举报
拿币走人
回复 使用道具 举报
    FileInputStream fis = new FileInputStream(“c:\\1.mp3”);
        FileOutputStream fos = new FileOutputStream(“c:\\2.mp3”);
回复 使用道具 举报
············································赞
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马