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 java beans?
what is the difference between static class and singleton class? can we create static class?
2 Answers L&T, Octazen, Vamsi Labs,
What is an infinite loop? How infinite loop is declared?
What is an inner class in java?
Can we access private data outside of the class directly in java programming language? Why There is no runtime checking in java, which leads to access the private data directly outside of a class?
In Java, what’s the purpose of static methods and static variables?
Explain about collection interface in java?
Why deletion in linkedlist is fast than arraylist?
Can you have a constructor in abstract class?
What is null in java?
Explain some best practices you would apply while using collection in java?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?