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
Is it necessary for the port addresses to be unique? Explain with reason.
What is the byte range?
What does this mean java?
What is the name of the java compiler?
What is the difference between this() and super() in java?
What is the base class of all exception classes in java?
What is the use of default method in interface in java? Explain
What are the classes of java?
Describe string intern() methodology
Why is java so important?
What do you understand by an io stream?
Is string a datatype?
Can we create object of inner class in java?
How do you ensure that n threads can access n resources without deadlock?
What is the use of arrays tostring () in java?