adplus-dvertising
frame-decoration

Question

What is the output of the following snippet running with “java demo I write java code”?
public class demo
{
   public static void main(String args[])
   {
        System.out.println(args[0]+""+args[args.length-1]);
   }
}

a.

The snippet compiles, runs and prints “java demo”

b.

The snippet compiles, runs and prints “java code”

c.

The snippet compiles, runs and prints “demo code”

d.

The snippet compiles, runs and prints “I code”

Answer: (d).The snippet compiles, runs and prints “I code”

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 following snippet running with “java demo I write java code”?