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 / srinu

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 A1
{
public static void main(String args[])
{
ConcreteChild obj = new ConcreteChild();
obj.parentMethod1();def of non abstract method from parent
obj.parentMethod2();def of parent abstract method from
abstract child
obj.childMethod1();def of non abstract method from abstract
child
obj.childMethod2();def of child abstract method from
concrete child
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification

1367


What is difference between == and === in js?

540


What are parameters in a method?

581


Is it possible to instantiate the abstract class?

534


What are the skills required for core java?

535






What is bean? Where it can be used?

595


What is final int?

522


How many bytes is a char in java?

522


What is java util concurrentmodificationexception?

493


What is meant by flickering?

648


What are the types of strings?

553


How do you add an element to a hashset in java?

486


What is garbage collection? Can it be forced to run?

539


What is the difference between object oriented programming language and object based programming language?

552


What is treeset in java collection?

515