Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is an immutable object? How do you create one in java?

1069


Which class should you use to obtain design information about an object in java programming?

1079


What are autoboxing and unboxing? When does it occur?

962


What is finally and finalize in java?

1094


What do you mean by platform independence of Java?

1157


How do you declare a string variable?

1021


How do you define a method?

980


How do you sort an array in java?

999


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

1010


How many bytes are a float?

983


What does system.gc() and runtime.gc() methods do?

1054


What is the applet security manager, and what does it provide?

999


What is append function?

1007


What is a line separator in java?

983


Where are local variables stored?

969