In the Java tutorial "Defining an Interface", it says
If you do not specify that the interface is
public
, your interface will be accessible only to classes defined in the same package as the interface.
However, this
interface PPInterface {
void foo();
void bar();
}
class NewClass implements PPInterface {
void foo() {}
void bar() {}
}
generates compiler errors in NewClass
because I am 'attempting to assign weaker access privileges; was public'. So the documentation is wrong, or I did something wrong, or I misinterpreted the documentation?
I suppose I don't have to use an interface-- I like it because it keeps things nicely organized.