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 an inner class in java?
What are non-access modifiers?
What is a flag value?
Which package has light weight components in java programming?
What do you mean by light weight and heavy weight components?
why the abstract class has default constructor?
Explain about main() method in java ?
why java does not contain pointers?
How to create a thread in java?
Why collection doesn’t extend cloneable and serializable interfaces?
What is port number in java?
What is the difference between a local variable and an instance variable?