A abstract class extending an abstract class.Super class
has both abstract and non-abstract methods.How can we
implement abstract and non-abstract mehtods? Explain with
snippet
Answer Posted / tulasi prasad
abstract class AbstractParent
{
void parentMethod1()
{
System.out.println("def of non abstract
method from parent");
}
abstract void parentMethod2();
}
abstract class AbstractChild extends
AbstractParent
{
void childMethod1()
{
System.out.println("def of non abstract
method from abstract child");
}
void parentMethod2()
{
System.out.println("def of parent abstract
method from abstract child");
}
abstract void childMethod2();
}
class ConcreteChild extends AbstractChild
{
void childMethod2()
{
System.out.println("def of child abstract
method from concrete child");
}
}
public class Test
{
public static void main(String args[])
{
ConcreteChild obj = new ConcreteChild();
obj.parentMethod1();
obj.parentMethod2();
obj.childMethod1();
obj.childMethod2();
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What class allows you to read objects directly from a stream in java programming?
How many types of the indexof method are there for strings?
Can we sort set in java?
Program to Find the second largest element in an array.
What is a method header?
What is a java developer salary?
What is the different between get and post?
What are the important features of Java 10 release?
What is Applet Stub Interface ?
What is java and why do we need it? Explain
How java enabled high performance?
Can substring create new object?
What is the difference between yielding and sleeping?
Explain about oops concepts.
Explain the differences between static and dynamic variables?