java - While constructing the default constructor can not handle exception : type Exception thrown by implicit super constructor -
the code works fine until try make code constructable class. when attempt construct object error
"default constructor cannot handle exception type ioexception thrown implicit super constructor. must define explicit constructor"
this when having throw exceptions filereader
, bufferedreader
.
thanks
edit:
filereader textfilethree = new filereader (xfile); bufferedreader bufferedtextthree = new bufferedreader (textfilethree) ; string linethree = bufferedtextthree.readline();
the xfile gotten construction. note within construction exceptions thrown.
default constructor implicitly invokes super constructor assumed throwing exception need handle in sub class's constructor . detailed answer post code
class base{ public base() throw someexception{ //some code } } class child extends base{ public child(){ //here implicitly invokes `base()`, handle here } }
Comments
Post a Comment