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



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

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

More Engineering AllOther Interview Questions

Hi i'm richa piplani applied for ATC(IT) if u have the syllabus & old question papers forward me.I will be very much thankful to you. piplani.richa@gmail.com and sonu_pips@yahoo.co.in

0 Answers  


what are the differences between structures and arrays in c language?

1 Answers  


to print greatest of two integers without using >,<,=.

0 Answers  


Are the JVM for C & JVM for JAVA are different?

1 Answers   Zensar,


Write a program to input 10 elements in an array and seperate even and odd numbers, positive and negative between them ?

0 Answers  






(53/3)r=(15)r ,find the value of r?

6 Answers   HCL, Syntel,


WHAT THE DIFFERENCE BETWEEN JCB 3DX & 3D?

7 Answers   HCC, L&T,


Write a java program to print the subsets of a string

0 Answers  


can i knw what are we supposed to read for the coming oces/dgfs 2009 exam?what kind of book are we supposed to study?

0 Answers  


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

0 Answers   Microsoft,


I want to prepare for PSU's bt i dont know how many PSU's are open for computer science students and what is the competition level for these. So if anybody knows this please guide me through this.

0 Answers  


can you justify your answer regarding output of following source-code: #include<stdio.h> #include<conio.h> void main() { clrscr(); if(printf("");) { printf("i am able to work in your company :"); } else { printf("your company is not able for having my knowledge :") } getch(); }

1 Answers   Wipro,


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)