This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "query" Watch "query" New topic


Kartik Mahadevan
Ranch Hand

Joined: Feb 16, 2005
Posts: 47
Whenever I try to use a code in which Interface method is not declared as public I get a message " Attempting to assign weaker access previliges;was public"
but I have declared the Interface as public in a seperate file for declaring an interface.

marc weber

Joined: Aug 31, 2004
Posts: 11343

Methods in interfaces are implicitly public. (Such is the nature of interfaces.) So when an interface's methods are implemented, they must be explicitly declared public; because they would otherwise have "less public" default access, which would present a problem in terms of polymorphism.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
marc weber

Joined: Aug 31, 2004
Posts: 11343

Note: This ties in with Paul's response to your other post on this topic...
It is sorta covered in the JavaRanch Style Guide.
subject: query
Similar Threads
variable in interface
Interface Methods
Dan's question ambiguity
interface within a class
Why so much difference in Interface's Variable & method