aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt on Modifiers 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 "Doubt on Modifiers" Watch "Doubt on Modifiers" New topic
Author

Doubt on Modifiers

balajee annamalai
Ranch Hand

Joined: May 09, 2007
Posts: 31
I know that we cannot declare a class as both abstract and final this is beacuse both modifiers are opposite to each other.But i dont understand why cant we declare a class as private or protected is there any reason behind this?
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1824
    
    7

You can, in fact, use any visibility modifier when declaring a class, be it package default, private, protected or public.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Nadeem Khan
Ranch Hand

Joined: Nov 27, 2007
Posts: 108
Hey Jelle,
Can you please give an example where we can declare a class as "private".Because it is not allowed with class-declaration statement as far as i know.


<i>If there were no Exceptions (not Errors!), Life would have kinda sucked!!</i>
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1824
    
    7

Only in the case of an inner class definition.
I'm afraid my previous statement was lacking nuance.

Nadeem Khan
Ranch Hand

Joined: Nov 27, 2007
Posts: 108
Ok that explains
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on Modifiers