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
Why java does not support pointers?
Can constructor be synchronized?
What is the difference between super class & sub class?
What are the uses of java?
How many bytes is string in java?
Can static methods access instance variables in java?
Can you call a method on a null object?
Why you should not use singleton?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
What is the range of the short type?
What is basic syntax?
Why do we need wrapper class?
why are there separate wait and sleep methods? : Java thread
How do you remove duplicates from an array in java?
What is flush () in java?