Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Beginning Java and the fly likes Specifying method signature for constructor in an interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Specifying method signature for constructor in an interface" Watch "Specifying method signature for constructor in an interface" New topic
Author

Specifying method signature for constructor in an interface

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 776

Is it a good move to specify the constructor in an interface ?

Pros vs cons ?


Regards,

Pho
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 776

I apologize but this is one stupid question, since an interface cannot share the same name as a implementation class. Ignore.
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
The compiler will not permit it.
However, I have seen many people attempt to do it.
What they really want is an accessor method on the interface.
In your example, you want:



Tony Morris
Java Q&A (FAQ, Trivia)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24189
    
  34

Tony, can you explain?


[Jess in Action][AskingGoodQuestions]
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Specifying method signature for constructor in an interface