This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Why we can't decare doPost() as default access specifier? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why we can Watch "Why we can New topic
Author

Why we can't decare doPost() as default access specifier?

Soumya Ranjan Mohanty
Ranch Hand

Joined: Mar 07, 2010
Posts: 44
Why We declare the servlet class as Public and dopost() as public or protected??
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServlet.html

You cant reduce the visibility of doPost in Subclass .it is one of the Override rule.

also public servlet class is visible to other packages also.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why we can't decare doPost() as default access specifier?
 
It's not a secret anymore!