adplus-dvertising
frame-decoration

Question

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);
    }
}

a.

The snippet compiles, runs and prints 0

b.

The snippet compiles, runs and prints 1

c.

The snippet does not compile

d.

The snippet compiles and runs but does not print anything

Posted under Java Programming

Answer: (d).The snippet compiles and runs but does not print anything

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following Java program?

Similar Questions

Discover Related MCQs

Q. Recursion in Java is a way of calling the method from within the same method. State TRUE or FALSE.

Q. Java uses ___ type of memory to implement Recursion.

Q. Java uses Stack type memory instead of Heap type memory in implementing Recursion because of ___ feature of STACK.

Q. Recursion in Java applies to ___.

Q. Uses are Recursion in Java are___.

Q. Which is better in terms of memory utilization Recursion or Loops in Java?

Q. Which is the common problem with Recursive methods in Java?

Q. Recursion usually stops when the Java Runtimeencounters an IF or ELSE statement with a RETURN statement. State TRUE or FALSE.

Q. Attempting to call a method recursively without a proper RETURN statement leads to ___.

Q. A Java program with recursion can be completed with few lines of code when compared to using Loops. State TRUE or FALSE.

Q. It is difficultto write a program with recursion than using multiple loops. State TRUE or FALSE.

Q. A Recursive method does not need to return a value always. State TRUE or FALSE.

Q. To end a recursive method a RETURN statement is usually kept inside ___.

Q. In most of the scenarios, a recursive method returns ____.

Q. What is the maximum number of levels in a Recursion?

Q. Which is bigger in size Stack Memory or Heap Memory?