what is the difference between abstract class and
Interface?where we can use it in realtime projects?

Answers were Sorted based on User's Feedback



what is the difference between abstract class and Interface?where we can use it in realtime project..

Answer / arvind

1.interface contains methods that must be abstract;
abstract class may contain concrete methods.
2.interface contains variables that must be static and
final; abstract class may contain non-final and final
variables.
3.members in an interface are public by default, abstract
class may contain non-public members.
4.interface is used to "implements"; whereas abstract class
is used to "extends".
5.interface can be used to achieve multiple inheritance;
abstract class can be used as a single inheritance.
6.interface can "extends" another interface, abstract class
can "extends" another class and "implements" multiple
interfaces.
7.interface is absolutely abstract; abstract class can be
invoked if a main() exists.
8.interface is more flexible than abstract class because
one class can only "extends" one super class,
but "implements" multiple interfaces.
9.If given a choice, use interface instead of abstract
class.

Is This Answer Correct ?    1 Yes 2 No

what is the difference between abstract class and Interface?where we can use it in realtime project..

Answer / rajesh

An abstract class must contain one abstract methiod while
in interface all method should be abstract.

Is This Answer Correct ?    0 Yes 2 No

what is the difference between abstract class and Interface?where we can use it in realtime project..

Answer / hanu

Both are same in many ways ..Except
if we extend that particular abstract class, we should be
implemented all those abstract methods in that class.
In the case of interface, we can implement any numbber of
methods to that interface ..

Is This Answer Correct ?    13 Yes 39 No

Post New Answer

More Core Java Interview Questions

where exactly collections are usefull in realtime

2 Answers  


What is java developer skills?

0 Answers  


What is use of valueof () in java?

0 Answers  


Define canvas?

0 Answers  


what are synchronized methods and synchronized statements? : Java thread

0 Answers  






can we take more than one null values for Unique constraints.

1 Answers   3i Infotech,


How can I debug the Java security exceptions and AccessControlExceptions?

0 Answers   IBM,


Explain notify() method of object class ?

0 Answers  


what is translator and it types

1 Answers  


Is special character in java?

0 Answers  


How to display arraylist values in java?

0 Answers  


What does super keyword do?

0 Answers  


Categories