Home » JAVA Programming » Modifier Types » Question
  1. Which of these access specifiers must be used for main() method?
    1. void
    2. private
    3. protected
    4. public
    5. None of these
Correct Option: D

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.



Your comments will be displayed only after manual approval.