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
Which class is used by server applications to obtain a port and listen for client requests?
What are encapsulation, inheritance and polymorphism?
What is the best definition for data?
What is fundamental datatype?
How do you check if a number is a perfect square?
Can a hashset contain duplicates java?
How is hashset defined in java?
Difference between collection, collection and collections in java?
Can we execute a program without main?
Which class is the superclass for all the classes?
Why java is considered as platform independent?
What are the differences between heap and stack memory in java?
Explain about the interpreter in java?
Describe different states of a thread.
What is stack example?