Why only one Class is public in one file? Explain in
details. Thanks in Advance.

Answers were Sorted based on User's Feedback



Why only one Class is public in one file? Explain in details. Thanks in Advance...

Answer / ganesh slv

Sorry for all my answers above.. I misunderstood lot of things.

Is This Answer Correct ?    0 Yes 0 No

Why only one Class is public in one file? Explain in details. Thanks in Advance...

Answer / madan

public static void main(String args[])

this is command line args.. we need to declare public because, this is the main method, from any class, any package, we have to call, so it will be public.. same as class is also public...suppose, if u declare two class as public, it show error, we have to save a file somefile.java...

i think u understood based on above explanation..

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

What is java basic concept?

0 Answers  


What is javac in java?

0 Answers  


What is the USE of Null interfaces ??...if thers nothing inside these interfaces how are they used and WHy are they used ???? No 1 has given a proper description yet

1 Answers  


What is private static in java?

0 Answers  


explain the clone method and clonable interface

1 Answers  






Can we use a default constructor of a class even if an explicit constructor is defined?

0 Answers  


how to handle exceptions in ejb?

1 Answers   HCL,


What are exceptions

0 Answers   Futures First,


What is hard code & soft code?

7 Answers   Cognizant, Wipro,


What is nextline method in java?

0 Answers  


What do you understand by the term polymorphism?

0 Answers  


Is ruby built on java?

0 Answers  


Categories