黑马程序员技术交流社区
标题:
这应该是多态啊,为什么错呢?
[打印本页]
作者:
谢波
时间:
2013-2-7 21:41
标题:
这应该是多态啊,为什么错呢?
package mypackage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.omg.CORBA_2_3.portable.OutputStream;
public class ClassLoaderTest {
/**
* @param args
*/
public static void main(String[] args) throws Exception{
File srcFile = new File(args[0]);
File destDir = new File(args[1]);
FileInputStream fis = new FileInputStream(srcFile);
File destFile = new File(destDir,srcFile.getName());
FileOutputStream fos = new FileOutputStream(destFile);
cypher(fis,fos);//编译不能通过,为什么呢?不是多态吗?求解
}
private static void cypher(InputStream is,OutputStream os)throws Exception
{
int b = -1;
while((b=is.read())!=-1)
os.write(b ^ 0xff);
is.close();
os.close();
}
}
复制代码
作者:
朱玉玺
时间:
2013-2-7 21:59
兄弟,OutputStream你的包导错了 import org.omg.CORBA_2_3.portable.OutputStream; 应该导入java.io.OutputStream.
作者:
谢波
时间:
2013-2-7 22:11
{:soso_e127:}谢谢了
晕死
看来 真是老了
作者:
胡发友
时间:
2013-2-7 22:38
同学,File类有构造函数可以接受数组的?
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2