Hi, I have the following Hello World app written in Java: package helloworldapp;
ID: 3610310 • Letter: H
Question
Hi,I have the following Hello World app written in Java:
package helloworldapp;
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {
/**
* @param args the command linearguments
*/
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
I am asked to modify the "Hello World" app to instead print anelement (any element) of the
args[] array which ispassed in as a parameter to main method. Also, by experimentingwith different command line invocations of the "Hello World" app, Ineed to come up with the relationship between the contents ofargs[] and the command line. That is, to describe therule for determining the contents of args[].I am also given the following hint: try using a command lineinvocation such as:
$ java myHello some kind of arg
I need help clarifying what exactly is asked of me to do.
What does it mean to parameterize an application? And any ideas on where to begin
to get the relationship between the contents of the array and the command line?
Thanks!
Explanation / Answer
please rate - thanks to run this program, go to command prompt, directory the program isin type java commandinhello hello public class commandinhello { /** * @param args the command linearguments */ public static void main(String[] args) { String message; message=args[0]; System.out.println(message); // Display the string. } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.