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

What is the use of default method in interface in java?

792


What is a buffer in computer?

738


What is the best definition for data?

740


What is the difference between conversation & casting?

812


What does super keyword do?

793


How to make a non daemon thread as daemon?

826


Which collection is best for sorting in java?

904


What is return data type?

794


Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.

2497


Is there a case when finally will not execute?

783


what is the difference between a threads start() and run() methods? : Java thread

788


Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain

1697


What is unmodifiable collection in java?

725


Explain java coding standards for constants?

800


Which containers use a flowlayout as their default layout in java programming?

748