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.
prsubjectAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
>>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
 
objectsConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.