Skip to content
Advertisement

Java inheritance using super keyword

I am using inheritance along with super function in my program ,but when I am extending my class it showing error message “There is no default constructor in ‘cc’. ” . This error message is coming after 1st subclass is extended and trying to make 2nd subclass. Here is the code

JavaScript

Advertisement

Answer

dd inherits cc, so it’ll have to call the default constructor of cc, which currently doesn’t exist.

To solve this, just add a constructor with no arguments

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement