Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing interface in Class

 
Thomas Markl
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implementing interface in Class
What did I wrong?



Thanks for your answers.
Thomas.
[ edited to preserve formatting of error message -ds ]
[ August 12, 2002: Message edited by: Dirk Schreckmann ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try
public interface blabla{}
cause default modifier is only accessable for a package. And your class was public.
I think this caused the error
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the interface may have default (package) access. This isn't a problem. However, inside an interface, all methods are implicitly public (i.e. even though they may not be declared as public). Thus when you implement the methods in a class, the implementing methods must be public as well. And inside a class, you must explicitly declare a method to be public, in order to make it so.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic