object cannot be resolved in finally block -


why error: rawdata cannot resoled in block?

in:

    public void parsedata(string filename) throws ioexception {     try     {         datainputstream rawdata = new datainputstream(new fileinputstream(filename));         /* here i'm gonna something*/      }     catch (filenotfoundexception e)     {         e.printstacktrace();     }         {         rawdata.close();     } } 

thank you

you declared rawdata inside try block.
variable not exist outside of it.
in particular, happen if try block exits before line?

you need move declaration outside try.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -