0
0
Javaprogramming~15 mins

Syntax for command line arguments in Java - Interactive Code Practice

Choose your learning style8 modes available
ads_clickPractice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the main method that accepts command line arguments.

Java
public static void [1](String[] args) { }
🎯 Drag options to blanks, or click blank then click option
Amain
Bstart
Crun
Dexecute
Attempts:
3 left
2fill in blank
medium

Complete the code to print the first command line argument.

Java
System.out.println(args[1]);
🎯 Drag options to blanks, or click blank then click option
A[0]
B(0)
C{0}
D<0>
Attempts:
3 left
3fill in blank
hard

Fix the error in the main method declaration to accept command line arguments.

Java
public static void main([1] args) { }
🎯 Drag options to blanks, or click blank then click option
AString
Bstring
CString[]
DString args[]
Attempts:
3 left
4fill in blank
hard

Fill both blanks to declare the main method with command line arguments and print the number of arguments.

Java
public static void [1](String[] [2]) {
    System.out.println([2].length);
}
🎯 Drag options to blanks, or click blank then click option
Amain
Bargs
Cargv
Dstart
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to declare main, access the second argument, and print it.

Java
public static void [1](String[] [2]) {
    System.out.println([2][3]);
}
🎯 Drag options to blanks, or click blank then click option
Amain
Bargs
C[1]
D[0]
Attempts:
3 left