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
What do you mean by synchronized non access modifier?
Under what conditions is an object’s finalize() method invoked by the garbage collector?
What are the 7 types of characters?
What is anagram in java?
Why is sizeof not a function?
What is gui programming?
What are basic data types?
Explain restrictions on using enum?
What is the use of bufferedreader?
what are the states associated in the thread? : Java thread
Is it possible for yielded thread to get chance for its execution again ?
Can we overload run() method in java?
Can we declare array without size in java?
How can we find the sum of two linked lists using stack in java?
What are the files generated after using IDL to java compiler?