aspose file tools*
The moose likes Beginning Java and the fly likes Question on Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question on Interface" Watch "Question on Interface" New topic
Author

Question on Interface

Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25
Hi,

Last weekend one of my colleague faced the interview.Interviewer asked him Interface Vs abstract Interface.
He knows Interface he defined it well but for abstract Interface he replied same like interface but keyword abstract is used and it is redundant because interface is also abstract.But here we are explicitly write abstract for abstract Interface.

Interviewer was not happy with the answer.

I am also thinking what can be the best answer.Also same like interface but keyword abstract is used.

Like say:

Please throw some light on this abstract Interface.



Thank You!

Regards,
Rahul
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3168
    
  47

In Java, there is no use of specifying "abstract" keyword for an interface - all of the Java interfaces are implicitly abstract.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Every method in an interface is public and abstract, and every field in an interface is public, static and final. If you leave out any of these words that doesn't change a thing -- they are still regarded to be there.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
If you told an interviewer there is a difference between an interface and an abstract interface, you wouldn't expect to get the job. You sure it wasn't "abstract class"?
Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25
Thanks all....

This question was asked to my colleague in a interview.His expression was there with awkward sound abstract interface....Then he thinks to better answer it and he answered as same like interface but keyword abstract is used and it is redundant because interface is also abstract.

After weekend my colleague also discussed the same with me.I was also surprised because i never came across such abstract interface term.....


Any way yeah it make sense now after discussion with you guys
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on Interface