This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 761

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: 761

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: 24183
    
  34

Tony, can you explain?


[Jess in Action][AskingGoodQuestions]
 
wood burning stoves
 
subject: Specifying method signature for constructor in an interface
 
Similar Threads
Cloneable vs. copy constructor
A small doubt while calling overriden method
SCJP6 book page 298 errata