Inheritance Syntax - Core Java

Q.  The following Syntax is used for?

class Subclass-name extends Superclass-name
{
//methods and fields
}

- Published on 19 Oct 15

a. Polymorphism
b. Encapsulation
c. Inheritance
d. None of the above

ANSWER: Inheritance
 

    Discussion

  • Nirja Shah   -Posted on 20 Aug 15
    A class which is derived from another class is called subclass and it inherits all the fields and the method of its superclass. Java provides different types of single,multilevel,hierarchical,multiple and hybrid.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)