byte abc[]=new byte[80];
    FileOutputStream oFile;
    try{
      oFile=new FileOutputStream("d:\\temp.txt");
      oFile.write(abc);
    }catch(IOException e1){}
    finally{
      oFile.close();
    }报错:variable oFile might not have been initialized at line 63, column 7
咋整,同志们!

解决方案 »

  1.   

    局部变量必须初始化;
     FileOutputStream oFile=null;
      

  2.   

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    byte abc[]=new byte[80];
    FileOutputStream oFile=null;
    try{
          oFile=new FileOutputStream("d:\\temp.txt");
          oFile.write(abc);
          oFile.flush();
        }catch(IOException e1){}
        finally{
          try{
           oFile.close();
          }catch(IOException e1){}
        } }
      

  3.   

    static void f5 () throws IOException {
     byte abc[]=new byte[80];
     FileOutputStream oFile =new FileOutputStream("d:\\temp.txt");
     oFile.write(abc);
     oFile.close();