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 |
Which one will take more memory: an int or integer?
Explain in detail about encapsulation with an example?
Explain what are final variable in java?
Can we override private methods?
Can an abstract class be final?
Why is stringbuffer called mutable?
What is static variable with example?
Difference between notify() method and notifyall() method in java?
question on Thread synchronization
What language is an assembler written in?
What is the difference between hashmap and hashtable in java?
Difference between error and exception