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

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

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