Multiple choice

Which is the correct signature for the main() method?

  1. public static int main(String args)

  2. public static void main(String arg)

  3. public static final main()

  4. public static void main(String[] args)

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The standard entry point for any standalone Java application is the main method, which must be declared as 'public static void main(String[] args)'. This signature specifies that the method is accessible from anywhere, does not require an instance of the class to run, returns nothing, and accepts an array of String arguments.