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 the root class for all Java classes?
What is a final class in java?
Difference between Application and Applet ?
What is encapsulation? Elaborate with example?
What is a variable analysis?
How many types of methods are there in java?
What is a newline character in java?
Give few difference between constructor and method?
What is the default value of local and global variables?
What are the pillars of java?
What is set and get methods in java?
What is class forname?