我练习用的..直接写在main函数里的....但是这个finally会报错~!~!
FileInputStream fileobject;
try
{
fileobject = new FileInputStream( "123.txt ");
int size;
size = fileobject.available();
char[] text = new char[200];
for(i = 0 ; i <size;i++)
{
text[i] = (char)fileobject.read();
System.out.print(text[i]);
}
}
catch(FileNotFoundException ffce)
{
System.out.println( "文件未找到 ");
}
catch(IOException ie)
{
System.out.println( "IOException异常 ");
}
finally
{
fileobject.close();
}
Util.java:90: variable fileobject might not have been initialized
fileobject.close();
^
Util.java:90: unreported exception java.io.IOException; must be caught or declared to be thrown
fileobject.close();
^
2 errors
------解决方案--------------------
另外 第一个问题的 你是在try子句里面初始化的,所以,系统认为你没有初始化