What Will Be The Output Of The Following Java Code Snippet #284
What will be the output of the following Java code snippet running with "java demo I write java code"?</p> <pre><code class="language-java" line="1"> public class demo { public static void main(String args[]) { System.out.println(args[0]+""+args[args.length-1]); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs128 Java. It can also be found in gs gs128 Java Classes Methods - Java Command Line Arguments - Quiz No.1.
What will be the output of the following Java code 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]); } }
The snippet compiles, runs and prints "java demo"
The snippet compiles, runs and prints "java code"
The snippet compiles, runs and prints "demo code"
The snippet compiles, runs and prints "I code"