• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Interface vs Abstract Class

Generally when anyone says when or why do we use Interface instead of extending from class, the answer immideately given is Java doesn't support multiple inheritence hence we use interface. Some people say that it is bookish and the more better answer is if we do not have a clear idea about the code that goes into that function we frame the interface if not we can go for abstract class.

My question is if we do not have a clear idea about the functionality how come we could design the interface.
0
prsubject
Asked:
prsubject
  • 2
2 Solutions
 
CEHJCommented:
>>My question is if we do not have a clear idea about the functionality how come we could design the interface.

It's not the functionality that's undecided and variable - it's the implementation
0
 
Amitkumar PSr. ConsultantCommented:
Agreed with CEHJ, it's an implementation.

prsubject,
please refer http://www.javaworld.com/javaworld/javaqa/2001-04/03-qa-0420-abstract.html?page=1 for more understanding.
0
 
objectsCommented:
You only need to specify the api to design your interface. You do not require a clear idea of the functionionality to achieve that, you just need to know what methods you need.
0
 
CEHJCommented:
:)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now