Wednesday 2 November 2011

Super method in Java| Java tutorials

super() method is used to call superclass constructor from subclass constructor. Depending on the parameters we pass, appropriate super() method is called.

Restrictions of using super():

a)If exists, it must be the first statement in the constructor.

b)We cannot use two super() methods within the same constructor as both cannot be the first. We cannot use two super() statements or two this() statements or one super() or one this() within the same constructor.




No comments:

Post a Comment