/** * Hello world class * * Used to display the phrase "Hello World" in a console. * * @author Sean */ classHelloWorld { /** * The phrase to display in the console */ publicstaticfinalstringPHRASE="Hello World!"; /** * Main method * * @param args Command line arguments * @return void */ publicstaticvoidmain(String args[]) { // Display our phrase in the console. System.out.println(PHRASE); } }
/** * Enterprise Hello World class v2.2 * * Provides an enterprise ready, scalable buisness solution * for display the phrase "Hello World!" in a console. * * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED * TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER * PARTY WHO MAY MODIFY AND/OR REDISTRIVUTE THE LIBRARY AS * PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING * ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL * DAMAGES ATRISING OUT OF THE USE OR INABILITY TO USE THE * LIBRAY (INCLUDING BUT LIMITED TO LOSS OF DATA OR * DATA BEINT RENDERED INACCURATE OR LOSSES SUSTAINED BY * YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO * OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER * OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF * SUCH DAMAGES. * * @author Sean * @license LGPL * @version 2.2 * @see System.out.println * @see README * @see license.txt * @todo Test of OS compatibility * @link https://github.com/sean-inc/helloworld */ classHelloWorld { /** * The first phrase */ publicstaticfinalstringPHRASE_HELLO="Hello"; /** * The second phrase */ publicstaticfinalstringPHRASE_WORLD="World"; /** * The first word in our phrase */ privateWordhello=null; /** * The second word in our phrase */ privateWordworld=null; /** * Constructor * * @param hello First word to display in the console * @param world Second word to display in the console */ publicHelloWorld(Word hello, Word world) { this.hello = hello; this.world = world; } /** * Display the phrase "Hello World!" in a console * * @return void */ publicvoidsayPhrase() { // Display our phrase in the console. stringfirst=this.hello.toString(); stringsecond=this.world.toString(); System.out.println(first + " " + second + "!"); } /** * Sets the phrase to use for hello * * @param h The first phrase * @return void */ publicvoidsetHello(string h) { this.hello.setWord(h); } /** * Gets the phrase to use for hello * * @return Word */ public Word getHello() { returnthis.hello; } /** * Sets the phrase to use for world * * @param w The second phrase * @return void */ publicvoidsetWorld(string w) { this.world.setWord(w); } /** * Gets the phrase to use for world * * @return Word */ public Word getHello() { returnthis.world; } /** * Main method * * @param args Command line arguments * @return void */ publicstaticvoidmain(String args[]) { // Create a new dic so we can display our phrase on the // command line. DICd= DependencyInjectionContainer::factory(); HelloWorldhw=null; try { hw = d.newInstance(HelloWorld.class); } catch (DICInstanceException e) { System.err.println("There was an error creating an instance of HelloWorld."); return; } try { hw.setHello(PHRASE_HELLO); hw.setWorld(PHRASE_WORLD); hw.sayPhrase(); } catch (IOException e) { System.err.println("There was an IO error."); } catch (ConsoleException e) { System.err.println("There was a console error."); } catch (Exception e) { System.err.println("There was an unknown error."); } } }
/** * Used to display the phrase "Hello World!" in a console * * @author Sean * @see README */ classHelloWorld { publicstaticvoidmain(String args[]) { System.out.println("Hello World!"); } }