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.
why should we put public access specifer for any servlet class which extends GenericServlet or implement Servlet interface.
Why such a specification given by Servlet Container.where the servlet container executes,is servlet container and our class files run in same package or different package,if different ,i want to put my servlet in the same package what servlet continer class files are there ,then is my servlet work without writing public access specifier.
You should absolutely not put your classes into existing packages of other libraries; that is a problem waiting to happen. That means any Java code needs to be public in order to be called from unrelated code. This is true everywhere, not just in applets and servlets. Do you see an actual problem with declaring methods to be public?
Pavan Kumar Reddy
Joined: Dec 11, 2009
thanks for giving answer,but still i have some more doubts after understanding your best answer.
1.what type of problems can we get when i put my class file inside Servlet Container classes itself,just for testing.
2.If they are in differnet packages only there is a problem with access specifier,if i put in same what is the problem.
3.From which location ServletContainer executes and where Our Servlet object created.