In real time project when will we use Abstract class. and
what are the difference between abstract and interface.

Answers were Sorted based on User's Feedback



In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / aravind

Depending upon the requirement.

Abstract class---->it contains zero or more abstract methods.

ex HttpServlet and GenericServlet
HttpServlet contains all sre concrete methods but it
declared as a Abstract class.

InterFace--->It contains all abstract methods.

if we extends the abstract class .there is chance to extend
another class.

if we implements the interface we can extends another class

Is This Answer Correct ?    17 Yes 5 No

In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / avinash

In Real time,we use Abstract class when we want the
implemented functionality to be used . In Abstract class ,
there may contain Abstract methods or non abstract
methods(concrete methods).

When we dont want the functionality provided by the abstract
class then we are going to make use of Interface. we
directly implement the interface and provide functionalities
for the abstract methods.

Is This Answer Correct ?    7 Yes 2 No

In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / satish

In real time when u extend Abstract class no need t provide
implementation f all methods & it contains one abstract
method remaining al r concrete methods
whereas interface we have t provide implementation f all
methods & by default al r abstract methods

Is This Answer Correct ?    10 Yes 9 No

In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / meena

in real time project we can use the abstract class so that
the subclasses can be extended so the functionality of the
project becomes easy as per the needs of the things required
in the project
in case of interfaces we can make use of the abstract
methods which means that we can make use of the other class
as interface (which means we can make use of the interface
class by adding the word implements) so that the methods of
the implemented class can be used in our project.
which in turn makes the work more easier.

Is This Answer Correct ?    2 Yes 1 No

In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / gopi

abstract class means--it has atmost one abstract
method.remaining might be abstract or not.

interface means ---it has almostall abstract methods.u have
only the method specification.

In real time if u want to share the some common features in
the abstract class u have to extends the abstract class.
so, u need not wrote the body to the all the methods.
if u implement interface u should write body to the all
the methods.

Is This Answer Correct ?    12 Yes 13 No

In real time project when will we use Abstract class. and what are the difference between abstract ..

Answer / naveen verma

Abstract Class:- its should have declared as abstract and must contain atleast one abstract method. an abstract class can be extended from either an abstract class or the class which is extending the abstract class should implement all methods of abstract method.

Interface:- In interface the methods are only declared not define the class which implementing the interface can define the method body as per its need. its not mendatory to define every method of the interface.


In really time application we extend abstract class only we when we need to modify the class. where as interface can be used to implements its method.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Advanced Java Interview Questions

What if the static modifier is removed from the signature of the main method?

0 Answers  


What is scalable, portability in the view of J2EE?

0 Answers  


Will the general public have access to the infobus apis?

0 Answers  


What is the argument type of a programs main() method?

0 Answers  


Can we have more than one action servlet?

7 Answers   HP,






why we use main in java?

4 Answers  


Suppose there are 3 combo box. SELECT COUNTRY SELECT STATE SELECT CITY if i select any country from country conutrylistbox values in the state will get automatically inserted with database values>> THEN on selection of state city will be inserted in city combo box If you can help then please Help me...

2 Answers   HCL,


What is the difference between ear, jar and war file?

0 Answers  


What is jboss?

0 Answers  


diff between jsp include directive and jsp action include?

4 Answers   SolutionNET,


What is the O/P of the below Code Snippet ? And how does it imply the concept of call-by-value/call-by-reference. (Note : Pls ignore syntx errors) public class One { sop ("Into One--"); } public class Two extends One{ sop ("Into Two--"); } public class Home { One a; Two t; public static void main(argv[]) { sop ("In Home--"); sop(One.a); sop(Two.a); sop(One.t); sop(Two.t); } }

2 Answers   Wipro,


What are the methods used for inter-thread communication? and in what class these methods are defined?

2 Answers  


Categories