adplus-dvertising
frame-decoration

Question

What is the output of the below Java program?
public class CommandLineArguments3
{
  public static void main(String[] args)
  {
    String name = args[0];
    int age = Integer.parseInt(args[1]);
    Boolean married = Boolean.parseBoolean(args[2]);
    Float salary = Float.parseFloat(args[3]);
    System.out.println("Name="+name + ", Age=" + age + ", Married=" + married + ", Salary=$"+ salary);
  }
}

C:\folder>java CommandLineArguments3 Marker 25 false 5025.35

a.

Name=Marker, Age=25, Married=false, Salary=$5025.35

b.

Name=Marker, Age=25, Married=false, Salary=$5025

c.

Compiler error

d.

None of the above

Posted under Java Programming

Answer: (a).Name=Marker, Age=25, Married=false, Salary=$5025.35

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the below Java program?

Similar Questions

Discover Related MCQs

Q. Which are the methods used to parse string values to the respective data types in Java?

Q. Any type of data that can be typed on a console or ECLIPSE can be passed as a command-line argument. State TRUE or FALSE.

Q. Which is the exception or error that is thrown if a non-existing command-line argument is referred to in a Java program?

Q. Choose the correct way of receiving command-line arguments with in the MAIN method in Java?

Q. To pass a string as a command-line argument in Java, you need to surround the text within a pair of ___.

Q. Is there any limit to the number of spaces between two arguments of command-line arguments in Java?

Q. Can you pass a sentence with multiple words separated by spaces as a single command-line argument in Java?

Q. The delimiter used to separate command-line arguments in Java is ____.

Q. The data that is passed at the time of running a Java program as command-line arguments are converted into ___ data type.

Q. The type of Arguments the MAIN method accepts is ___.

Q. The command-line arguments in Java are used along with a ____ command.

Q. Which is the method that accepts data passed in the form of command-line arguments in Java?

Q. If you need to accept data at runtime, you use ___ in Java.

Q. When a Java program is executed once, how many times can you pass data using the Command-line arguments?

Q. The command-line arguments are passes at ____.

Q. Command-line arguments help in a way of ____ data to a program.

Q. A command-line argument in Java is a value passedat the time of ___ a program.

Q. Which of the following is method of wrapper Float for converting the value of an object into byte?

Q. Standard output variable "out" is defined in which class?

Q. Which of these class have only one field "TYPE"?