• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why should be public?  RSS feed

 
Ganesan Ramakrishnan
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why shouldn't it be public?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15862
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!