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)
. 任何人都可以 p;ease 帮助我克服这个问题吗?