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 implicit object in java?
How do you define a method?
How to provide security in java
Explain about the main() method in java?
Is set ordered?
How would you use Bubble Sort to sort the number of elements?
What is the difference between this() and super() in java?
How many types of assembly languages are there?
Can sleep() method causes another thread to sleep?
Tell me are there implementations for sorting and searching in the java libarary?
What about main thread in java?
Explain importance of inheritance in java?
If system.exit (0); is written at the end of the try block, will the finally block still execute?
What is garbage collector?
What is a numeric format?