Sunday, 4 December 2016

Java - Inheritance in Contructor

Invoking constructor of  base class in derived class:-
        "super" is a keyword to invoke constructor of base class and also asccess members of base class.
eg:-
super();//default constructor
super(args);//parameterized constructor
        This statement should be written at very first line of the derived class constructor.
To invoke & access members of base class:
        super.variablename;

        super.methodname(args);

No comments:

Post a Comment

Featured post

Development Of JAVA Program