aspose file tools*
The moose likes Servlets and the fly likes Why should be public? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why should be public?" Watch "Why should be public?" New topic
Author

Why should be public?

Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 89
Hi all,

I have the doubt in servlet class declaration, is there any specific reason for declaring servlet class as public??

Regards
Ganesan
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Why shouldn't it be public?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14272
    
  21

The servlet container should be able to access your servlet class. If it wouldn't be public, the servlet container wouldn't be able to create instances of the servlet.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
 
subject: Why should be public?