What happens when a main method is declared as private?
Answer Posted / amit kumar chaubey
If the main function is made private...it will compile
Sucessfully...and at the time of execution...it will
execute successfully...but desired result will not be
obtained. After execution..folowin message will be printed:
Main method not public.
| Is This Answer Correct ? | 25 Yes | 3 No |
Post New Answer View All Answers
What modifiers may be used with a top-level class?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
What technique is carried out to find out if a particular string is empty?
Does garbage collection occur in permanent generation space in jvm?
Is java owned by oracle?
Explain access specifiers?
What is null in java?
Why are parameters used in functions?
Differences between external iteration and internal iteration?
List some java keywords sun like c, c + + keywords?
Can we inherit a class with private constructor?
What's the difference between comparison done by equals method and == operator?
What is void in java?
What is the use of hashmap in java?
What is the purpose of garbage collection in java? When is it used?