Which of the following signatures may be used to declare a method main() that will be the entry point when the application starts? (Select all valid options)

   1. public static void main()
   2. public static void main(String arg[])
   3. public void main(String [] arg)
   4. public static void main(String[] args)
   5. public static int main(String [] arg)
Explanation
The correct main definition is public static void and must accept array as a parameter. Both 2 and 4 are correct array of strings parameter definitions.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes