What happens when a main method is declared as private?
Answer Posted / chinmay
If main method declared as private then at compilation no problem but at run time it shows an error that main method should be public...
because we access the main() method out side from class if it is private then it cannot be accessible...
that's why we have to write public in main method signature...
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is difference between path and classpath?
Can memory leak in java?
Difference between notify() method and notifyall() method in java?
What is an off by one error in java?
How does compareto method work?
What does it mean that a method or field is “static”?
Why volatile is used in java?
What is string in java with example?
What is the properties class in java programming?
What is the method in java?
Difference between static synchronization vs. Instance synchronization?
How many types of memory areas are allocated by jvm?
What is string builder in java?
What are some examples of variable costs?
How to sort elements in a parallel array in java?