Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why to give the file name same as the public class name in
java?

Answer Posted / naresh kumar

If u dont keep public in front of class that is not
accessible by third party packages. But if u keep public
infront of class that is accessible by third party
packages.

Problem: class CheckServlet extends HttpServlet
{---- }
Now u want to executed this servlet class in server
(Tomcat,WebSphear,WebLogic) an error will come .Because the
above class is comes under default access modifier.

Ans: public class CheckServlet extends HttpServlet
{-------}
This class services will executed in any server(either
Tomcat,WebLogic etc.,). Because The class is visible in
third party class packages like container packages.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the gregoriancalendar class in java programming?

1089


Is java developer a good career?

1080


What are the advantages of exception handling in java?

1099


How static variable work in java?

1186


Can you have two constructors in java?

1044


Is java good for beginners?

1054


How to sort array in descending order in java?

959


What is the major advantage of external iteration over internal iteration?

1150


What are dot operator queries?

1150


What is busy spin, and why should you use it?

1128


What is meant by attribute?

1201


Difference between method overloading and overriding.

1132


Can the interface be final?

1061


What is the difference between a static and a non-static inner class in java programming?

1138


What are constants and how to create constants in java?

1036