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 string pool?
Is main a keyword in java?
What are types of Java applications?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
What is singleton class example?
What is the purpose of using the java bean?
how to java plateform independent?
What isan abstract class and when do you use it?
Interface A { String test(); } Interface B { int test(); } Create a class AB which must implements both A & B interfaces.
What are the differences between heap and stack memory?
What is jvm? How its run?
What happens if an exception is throws from an object's destructor?