Describe inheritance as applied to java?

Answer Posted / chandra rekha

Inheritance is one of the OOPS concepts(the OOPS concepts
are Abstraction,Encapsulation,Polymorphism and Inheritance).
Java is purely a OOP language.

Inheritance is the ability of a class to use member data
and methods of another class.This is done by deriving a
class from a diff class.The class from which it derives is
called the base or the parent or super class and the class
which derives is called the derived or the child or sub
class.

Java supports two types of inheritance SINGLE inheritance
and MULTILEVEL inheritance."extends" is the keyword to
inherit properties of the base class.All the derived
classes having a single base class is termed as the single
inheritance.for example
class A
{
...
}
class B extends A
{
...
}
public class C extends A
{
...
}
this is single inheritance

whereas, a class inherits the properties of another class,
for example
class A
{
...
}
class B extends A
{
...
}
public class C extends B
{
...
}

java doesnot support multiple inheritance.However, a class
can implement any number of interfaces(interface is a
collections of methods with no definition(abstract methods))

Is This Answer Correct ?    13 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is nan false?

727


What do you understand by final value?

796


what is meant by Byte code concept in Java?

793


What does it mean to be immutable?

755


What does jenkins do?

680


What defines function?

740


I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

736


Can we extend a class with private constructor?

724


Explain what pure virtual function is?

793


Can I learn java without any programming experience?

783


Explain about public and private access specifiers?

771


Which methods cannot be overridden in java?

750


What is your platform’s default character encoding?

785


Is arraylist a class in java?

750


Why collection is called framework in java?

722