黑马程序员技术交流社区
标题:
请看看这段代码哪里有错啊
[打印本页]
作者:
完美恋爱
时间:
2013-10-15 08:22
标题:
请看看这段代码哪里有错啊
本帖最后由 杨增坤 于 2013-10-15 08:53 编辑
import java.io.*;
class My
{
public static void main(String[] args)
{
FileOutputStream fos = null;
FileInputStream fis = null;
try
{
fos = new FileOutputStream("bbb.jpg");
fis = new FileInputStream("aaa.jpg");
byte[] b = new byte[1024];
int len = 0;
while((len = fis.read(b)) != -1)
{
fos.write(b,0,len);
}
}
catch(IOException e)
{
throw new RuntimeException("shibai");
}
finally
{
try
{
if(fis != null)
fis.close();
}
catch(IOException e)
{
throw new RuntimeException("shibai");
}
try
{
if(fos != null)
fos.close();
}
catch(IOException e)
{
throw new RuntimeException("shibai");
}
}
}
为什么提示的错误是:进行语法解析时已到达文件结尾
这是什么意思啊?我哪里写错了吗?
作者:
赖波
时间:
2013-10-15 08:41
最后加个括号试下,报这错很可能是少了括号
作者:
终结者
时间:
2013-10-15 09:41
结尾是四个括号
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2