• Post Reply Bookmark Topic Watch Topic
  • New Topic

Quickie about Interfaces  RSS feed

 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, just wanted to ask a short question.
Hope you guys don't mind...

When you write an Interface with no access modifier,

Is it actually implicitly public?

Well, thank you very much...
best wishes,
Jose
 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When you write an Interface with no access modifier,
Is it actually implicitly public?

No, in this case it will has default access i.e package level.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You maybe getting confused with method and field declarations which are implicitly public.

Note: You can use any of the access modifiers when declaring an interface but not all are valid in all cases ie static, protected and private are only valid for member level interfaces.
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again.

Excuse me, and what does it mean when an Interface has default access?

Which classes will be able to reach it? Could someone please detail that for me.

Thanks for all the care you've taken replying all my trivial questions.

Until next time fellas!
Good Luck,

Jose
 
ahmed yehia
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

and what does it mean when an Interface has default access?
Which classes will be able to reach it? Could someone please detail that for me.

When an interface has default access Only classes/intefaces within the same package can access that interface.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jose Campana:
Excuse me, and what does it mean when an Interface has default access?

Java has four access levels: public, protected, private and no access modifier (which is "default" access). See The Java Tutorial - Controlling Access to Members of a Class.
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdi Partners!

I believe this question has been successfully satisfied. I just have to add the final expression of gratitude..

'**Thanks !**

See you next time!
Jose
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!