aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A confirmation required about interfaces... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A confirmation required about interfaces..." Watch "A confirmation required about interfaces..." New topic
Author

A confirmation required about interfaces...

Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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??


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Heba Mahmoud
Ranch Hand

Joined: Apr 26, 2009
Posts: 62

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.


SCJP Pass 85%....
Thousands of candles can be lighted from a single candle, and the life of the candle will not be shortened
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Nov 04, 2009
Posts: 2066

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

Joined: Aug 03, 2008
Posts: 9313
    
  17

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A confirmation required about interfaces...