🎴 Flashcard Mode

COBOL and Java Programming Fundamentals

Card1 / 20
Mastered0
Review0
QuestionClick to flip

What does the zeroth element of the string array passed to the public static void main method contain?

AnswerClick to flip back
A
The first argument if one is present
💡 Explanation:

In Java's main(String[] args), args[0] is the first command-line argument passed to the program. Unlike C/C++, Java does not include the program name in the args array. If no arguments are provided, the array is empty and accessing args[0] would throw ArrayIndexOutOfBoundsException.

Change Mode