【发布时间】:2013-05-17 09:16:07
【问题描述】:
public class WriteByteArrayToFile {
public static void main(String[] args)
{
String strFilePath = "C://Program Files/Java/jdk1.7.0_23/bin//s.excel";
try
{
FileOutputStream fos = new FileOutputStream(strFilePath);
int numberBytes = fileinputstream.available();
byte bytearray[] = new byte[numberBytes];
fileinputstream.read(bytearray);
for(int i= 0;i < numberBytes;i++)
{
System.out.println(bytearray[i]);
}
fileinputstream.close();
}
catch(Exception e)
{
System.out.println(e);
MyReader mr = new MyReader();
mr.ReadFile("side1-60.java");
}
String strContent = "side1-60.java ";
fos.write(strContent.getBytes());
fos.close();
}
catch(FileNotFoundException e)
{
System.out.println("FileNotFoundException : " + ex);
}
catch(IOException ioe) {
System.out.println("IOException : " + ioe);
}
}
这是我的代码。我在编译时收到illegal start of type 的错误,尤其是在catch(FileNotFoundException e)。任何人都可以帮助我克服这个问题吗?
【问题讨论】:
-
如果你合理地缩进你的代码,你会看到你的最后两个 catch 块附加到你的
main方法,而不是你的 try 块。 -
@system32 不会导致此错误...
标签: java compiler-errors