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 stringbuilder is not thread safe in java?
What is the static keyword?
What is the difference between heap and stack memory?
How can you handle java exceptions?
What are three advantages of using functions?
What is a constructor overloading in java?
Can we extend private class in java?
What is the use of put method?
What does %d do in java?
What is difference between adapter class and listener?
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
Can we declare a static variable inside a method?
Is list thread safe in java?
What is a prefix function.write down a code to compute prefix function.
What do heavy weight components mean in java programming?