What Will Be The Output Of The Following Java Code Snippet Run #289
What will be the output of the following Java code snippet run as $ java Demo --length 512 --breadth 2 -h 3?</p> <pre><code class="language-java" line="1"> class Demo { @Parameter(names={"--length"}) int length; @Parameter(names={"--breadth"}) int breadth; @Parameter(names={"--height","-h"}) int height; public static void main(String args[]) { Demo demo = new Demo(); new JCommander(demo, args); demo.run(); } public void run() { System.out.println(length+" "+ breadth+" "+height); } } </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.