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 the point of polymorphism java?
When we should use serialization?
How do you check if two given string are anagrams?
What is the difference between == and === javascript?
How to instantiate static nested classes in java?
What is difference between variable declaration and definition?
What is the difference between jfc & wfc?
What is volatile data type?
Is java written in c?
What is null data type?
What is meant by 'Class access modifiers'?
Explain about interthread communication and how it takes place in java?
What is the abstract class?
What is ‘has a’’ relationship in java?
a thread is runnable, how does that work? : Java thread