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

Can we execute a program without main?

0 Answers  


Write a program to search a number in the given list of numbers.

0 Answers   Honeywell,


Can we override the static methods?

0 Answers  


What is operator overloading. Is it is supported in java?

0 Answers  


Can an interface extend a class?

0 Answers  






What is the purpose of the finally clause of a try-catch-finally statement in java programming?

0 Answers  


What’s a deadlock?

0 Answers  


enlist some features of jdk.

0 Answers  


What are the concepts of 'OOPS'?

0 Answers   Atos Origin,


What is the difference between abstract classes and interfaces?

0 Answers  


Can we change the scope of the overridden method in the subclass?

0 Answers  


What are keyboard events?

0 Answers  


Categories