write a simple program inheritance?

Answer Posted / prashant khot

class A
{

}
class B extends A
{
public static void main(String args[])
{
B b = new B();

}
}
In the above example, B is the class extending the A class.
Means that B is inherited from A.

Is This Answer Correct ?    26 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to overcome the exception object reference not set to an instance of object?

856


What is difference between == equals () and compareto () method?

722


How do you write a good declaration?

692


How does varargs work in java?

831


What is the maximum size of arraylist in java?

698


What happens if we override private method?

729


What is replacefirst in java?

773


How does regex work?

724


Explain tree set and its features?

800


How is tree Mirroring implemented?

811


Is a boolean 1 bit?

828


What is Major and importance difference between for and foreach loop ?

802


How many characters is 2 bytes?

727


Can we override private constructor in java?

709


What is string pool?

813