Java Training Course/JT03: Difference between revisions
Jump to navigation
Jump to search
imported>Gfis new |
imported>Gfis Bonus |
||
Line 12: | Line 12: | ||
* Before running the program, tell what you would expect as output from the following command: | * Before running the program, tell what you would expect as output from the following command: | ||
java DupString Hello World | java DupString Hello World | ||
* Bonus task: How would you make the output more readable with little effort? |
Revision as of 19:04, 22 September 2017
- Create a file
DupString.java
with the following modified copy of theHelloWorld
program:
public class DupString { public static void main(String[] args) { String st0 = args[0]; // the 1st parameter on the commandline String st1 = args[1]; // the 2nd ... String st2 = st0 + st1; st2 = st2 + st2 + st2 + st2; System.out.println(st2); } // main } // DupString
- Compile the program to be sure that you entered it with the correct syntax.
- Before running the program, tell what you would expect as output from the following command:
java DupString Hello World
- Bonus task: How would you make the output more readable with little effort?