Why only one Class is public in one file? Explain in
details. Thanks in Advance.
Answer Posted / 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 View All Answers
What is compareto?
What is quick sort in java?
What happens if a constructor is declared private?
What is double checked locking in singleton?
What is a singleton factory?
What is getkey () in java?
What is garbage collection? What is the process that is responsible for doing that in java?
What is communist flag?
Compare Mutex and Semaphore in java.
Can you tell me range of byte?
Can you override static methods?
How do constructors use this() and super()?
Why are the methods of the math class static?
What is the difference between replace and replace all?
How to remove the trailing spaces from a string?