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 -

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -