ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Why to give the file name same as the public class name in 
java?
 Question Submitted By :: Indu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Why to give the file name same as the public class name in java?
Answer
# 1
So that ,that class is accessible from some other class/file
as well
 
Is This Answer Correct ?    7 Yes 1 No
Akanksha Bansal
 
  Re: Why to give the file name same as the public class name in java?
Answer
# 2
First of all, it only has to be the same when the class is 
public. And there is no explicit reason for that, it's just 
a convention that came along with old versions of java and 
people got used to it... They say it's because of the 
limited capabilities of the compiler to compile 
dependencies.
 
Is This Answer Correct ?    7 Yes 1 No
Mahesh
 
 
 
  Re: Why to give the file name same as the public class name in java?
Answer
# 3
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 ?    3 Yes 0 No
Naresh Kumar
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what is a thread? IBM10
In what ways you can handle exception ?  3
How the elements are organized in CardLayout?  5
How applets will communicate with each other?  1
what is the use of custom tags? with example? Photon1
What is the default initialized value of String type variable?  3
What is casting? BMC3
After compilation of java program we'll get .class code. If it's generated in OS Windows XP will it work on OS Linux? If yes why? If no why? Aricent4
What is the need to implement Serializable interface (with no methods) for objects which are to be serialized ? We can write our own functionality which writes objects to streams then why we need to implement and tell JVM that which objects can be serialized. iFlex4
What is a Wrapper class?  9
can we declare private class in java file?  6
Who developed JScript language?  3
Explain the difference between the Boolean & operator and the && operator?  1
How a class can implement an interface? SysArc4
What is operator?  2
Why we can not force Garbage Collection?  5
What is difference between abstract class & final class  5
what is difference between excute query ()and execute update ()? Symphony5
Is it possible to write static method in abstract class? justyfy your answer? Hexaware3
How can you reverse a string?  4
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com