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

Suppose you want to form a conceptual model of UML.What elements would you require for this purpose?

1599


What is the instruction to load the register B?

1848


What is Landscape in Sap BW?

1668


what is rapid application development

1291


What is Mointer in Operating System?

1273






How can we share data between actions in qtp..pls tell me

1798


please tell me difference between router and cisco router

1662


find the net id and host id of the following IPV4 117.34.3.8 and 132.57.8.6

1935


if a customer's blackberry stopped syncing their calendar wirelessly what would you do?if a customber deleted mail from his blackberry but it did delete from his mailbox how would ypu resolve this

2556


hi i have selected for nda and could please send me the courses offered in nda regarding engineering and all other courses????

1428


What is the pattern for HAL Online-exam?

1672


question no. 4======Give a brief description of the following terms: a) Play head b) Symbol c) Tweening d) ActionScript e) Frame rate f) Library panel g) Masking h) Context – sensitive Property Inspector i) Bandwidth Profiler j) Frame Label

1447


i want to know ,If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits.

1722


How to select the total numbers of fire extinguisher installed in a room ?

1498


WHAT IS DIFFERENT BETWEEN YOU AND OTHER APPLICANT TO GIVE YOU THE JOB

1608