View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Overriding with constructors

    by , 04-26-2012 at 06:53 PM
    • A constructor canít be overridden in a superclass, because they are non-inherited.
    • A constructor canít be overridden in similar class because both of them would have similar signatures and compiler error would be there.
    • When a subclass object is instantiated & a method is called by superclass constructor which in superclass gets overridden, superclass constructor will be calling the subclass methods.



    Java Code:
    class Super {
        Super(){
            System.out.println("In
    ...
    Categories
    Overriding