Bird
0
0

Which data type is used for the parameter that holds command line arguments in the main method of a Java program?

easy📝 Conceptual Q1 of 15
Java - Command Line Arguments
Which data type is used for the parameter that holds command line arguments in the main method of a Java program?
AString array
Bint array
Cchar array
Dboolean array
Step-by-Step Solution
Solution:
  1. Step 1: Understand main method parameter type

    The main method receives command line arguments as an array of strings because each argument is text.
  2. Step 2: Identify correct data type

    Since arguments are strings, the parameter type is String[].
  3. Final Answer:

    String array -> Option A
  4. Quick Check:

    Command line arguments type = String array [OK]
Quick Trick: Command line args are always String arrays in Java [OK]
Common Mistakes:
  • Using int[] instead of String[]
  • Using char[] instead of String[]
  • Using boolean[] instead of String[]

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes