Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

public abstract interface question

Status
Not open for further replies.

maxpower1

Programmer
Jul 29, 2001
488
US
I understand that an interface is by default public and abstract that the keywords "public" and "abstract" not need be mentioned in an interface declaration. If the word "public" is not specified, that does this mean that the interface's access modifier is assumed "default"; mea ning no interfaces outside the package can EXTEND this interface or no class can implement this interface.

if so, that is one dangerous assumption not to include the word public in the interface declaration.

thanks
 
ooppss. replace the word "modifier: with "level":-

.... does this mean that the interface's access modifier....

with

.. does this mean that the interface's access level...

 
>> does this mean that the interface's access modifier is
>> assumed "default"

If you mean "package", since it is the default, yes.

-pete

 
thanks for the reply. I actually did some research and it turns out that the word public is implicitly assumed even though it is not stated. Hence, the access level is always public - not default. Therefore, due to this behavior, interfaces can be used across packages even though the word 'public' is not mentioned.
 
maxpower1 said
I actually did some research and it turns out that the word public is implicitly assumed even though it is not stated. Hence, the access level is always public - not default. Therefore, due to this behavior, interfaces can be used across packages even though the word 'public' is not mentioned.

I believe your research is flawed. "package" is the default not "public"

Also
the access level is always public - not default
there is no such access level as "default". The access level is the default if no level is implicitly stated, and the default level is package

Of course if you tried it you already know all this by now.

-pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top