2014年5月27日星期二

Those doubts constructor (compiler is not the case according to theparameters ...)

compiler is not the case according to the parameters , choose to call the constructor it? Not the first SubClass (), and then call the parent class constructor SuperClass (int n) do, how it will be given in line 19 (off SuperClass () what happened ) ?


------ Solution ------- -------------------------------------

  
method is not invoked only when implemented? Throughout the implementation process of the compiler , it is not related to SubClass (int n) ( do not call it off ) , how will the compiler do not go , there will be an error it?  
Who does not relate to ?
when the compiler generates bytecode files would be logical for the code inside other tests , whether you run do not run , you do not have a default constructor of the parent class , another subclass constructor , the compiler I will try to find the parent class , but can not find the natural error.

In other words , if there is such an error , the compiler never mind , then the programmer will miss much wrong?
------ For reference only ---------------------------------------
pass parameters when instantiating a ?
------ For reference only -------------------------------------- -
right in the place where you draw the red frame , wrong on SubClass (int) method of this structure . No parent class constructor with no arguments
------ For reference only ------------------------------- --------


method is not invoked only when implemented? Throughout the implementation process of the compiler , it is not related to SubClass (int n) ( do not call it off ) , how will the compiler do not go , there will be an error it?
------ For reference only -------------------------------------- -
learn, cattle mighty
------ For reference only ----------------------------- ----------
unless you are allowed to use the no-argument constructor
otherwise constructor with no arguments will be written on the
is to prevent subclasses appear to find less than a no-argument constructor of the parent class

没有评论:

发表评论