Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A confirmation required about interfaces...

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is, We can put any access modifiers(public, protected, default, private) to interface? Please confirm? Then what about the non-access modifiers? Only abstract??
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want us to confirm it when you can compile and check it??
 
Heba Mahmoud
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

only public and abstract modifiers are premeited for interface "top level interface"

but for interfaces that defined in classes what access modifiers is valid for it........ " no restrication " as in the example
as inner classes.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:

Why do you want us to confirm it when you can compile and check it??



Yea, correct.

Thanks a lot Heba Mahmoud for you valuable information...
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about default modifier for the interfaces? Because, It's said in the K&B's book, that.....

........


The public modifier is required if you want the interface to have public rather than default access......


Here the keyword abstract is redundant, But what about public, Is every interfaces are implicitly public?? No?? There are default interfaces?? Somebody confirm? Thanks in Advanced!
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:Is every interfaces are implicitly public?? No?? There are default interfaces?? Somebody confirm?

Again you can create an interface in one package and don't make it public and try to access it in a different package and you'll get your answer...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic