why we need abstract class in java, what is the diff b/w
abstract claas in c++ and abstract class in java

Answer Posted / nikhil naoghare

Abstact classses are those classes which can have abstact as well as Common methods. we use Abstract classes because we want to implement Polymorphism.
Its always good to prefer the abstract class because it will give us the addtional method declaration in the class.
We use Abstract class to enforce some rules to the classes which extends it. For example we can define a class say Car and we can declare methods say Color() Mileage(). This means whatever the class that is derived from Car has to override or give definition for Color() and Mileage() and therefore we are making sure that all the derived classes follows or has the common functionalities. In other way the classes derived from superclass should have common properties. In addition to this the derive class can have its own methods like Type().

In case of Abstract class we can define COMMON functionalities in super class and those can be used in the derived class where as in Interface we cant do that.

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which one is more efficient in terms of required memory space call-by-value or call-by-referance?

1415


computer is male or female.....???

1466


project plan for bug tracking system?

1616


why does the array will be start on size 0?

1590


List three things you can do with the files you create by recording your voice on your computer

3151






what is the effect of low frequency(say 48Hz) on TUrbo- Generator set when running for a prolonged period?

1895


how to count 4 column with two "and" condition in oracle? e.g task_type and cust_type and service_type are 3 column and we hv to count where task_type="new"and cust_type="jdp" and resulting column name will be new cust with jdp..and also we hv to count where task_type="new"and service_type="fs" resulting column name will be new cust with fs..

1342


explain various problem solving statagis

1581


what is total power generation capacity in india at present (as on 12-12-2011)

1661


what do you mean by a p-code?

1480


defference between menu and context menu in vb.net?

2388


Hello, I need to compare, using a cobol program, two cobol skeletons. I don't know if it is easy to do this or it will be so complicated. I wanna have your opinions. Thanks a lot

1488


Tell me all about production of drought and its losses In the boiler?

1238


Give the coding for system reboot in C

1424


What is the allowable load carrying capacity of a circular column section of 400 mm diameter reinforced with 6x25 mm diameter bars adequately tied with spirals? Consider concrete of grade M25 and steel of grade Fe 415.

1629