write a simple program inheritance?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / dhawal
class A
{
int a=10;
}
class B extend A
{
public static void main(String[] a)
{
B objB;
objB=new A();
System.out.println("Value of a is"+objB.a);
}
}
Is This Answer Correct ? | 2 Yes | 13 No |
What is ‘is-a ‘ relationship in java?
what is the difference between a java object reference and c++ pointer?
Explain features of interfaces in java?
What is the difference between yield() and sleep()?
Write a java program to generate fibonacci series ?
What is java developer skills?
Why do we declare a class static?
What are the types of strings?
What is difference between arraylist and list in java?
What is a singleton puppy?
What are exception handling keywords in java?
What is the symbol for space?