Java MCQ Questions - Java Command Line Arguments
This section focuses on the "Command Line Arguments" in Java programming. These Multiple Choice Questions (MCQ) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. ____________method can be given parameters via using command line arguments.
View Answer
2. Which of these data types is used to store command line arguments?
View Answer
3. Number of arguments can be passed to main() is?
View Answer
4. args in an array of String.
View Answer
5. What is the output for the following code, when you passed letsfindcourse at run time?
class CommandLineExample{
public static void main(String args[]){
System.out.println(""Your first argument is: ""+args[0]);
}
}
View Answer
6. What will be the output of the following Java program, Command line exceution is done as – “java Output This is a command Line”?
class Output
{
public static void main(String args[])
{
System.out.print(""args[3]"");
}
}
View Answer
7. Which annotation is used to represent command line input and assigned to correct data type?
View Answer
8. ___________ is a very small Java framework that makes it trivial to parse command line parameters.
View Answer
9. Which tab is used to pass command line argument in eclipse?
View Answer
10. What will be the output of the following Java program?
class abc
{
public static void main(String args[])
{
if(args.length>0)
System.out.println(args.length);
}
}
View Answer
Discussion