1.

Which of these access specifiers must be used for main() method?(a) private(b) public(c) protected(d) none of the mentioned

Answer» The correct choice is (b) public

Easiest explanation: main() method must be specified public as it called by Java run time system, outside of the program. If no access specifier is used then by default member is public within its own package & cannot be accessed by Java run time system.


Discussion

No Comment Found

Related InterviewSolutions