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 data type in computer?
Why should we use singleton pattern instead of static class?
Do I need java on my pc?
Is java good for beginners?
What is thread synchronization in java?
we cannot create an object of interface but we can create a variable of it
Who developed JScript language?
What is the importance of static variable?
what is finalmethod & final variable with example?
What is static and final keyword in java?
What is factor r?
Why string is a class?