class HelloWorld
{
public static void main(String args[])
{
// Display "Hello world!" on the console.
System.out.println("Hello World!");
}
}
/**
* Hello world class
*
* Used to diplay the phrase "Hello World!" in a console.
*
* @author Sean
*/
class HelloWorld
{
/**
* The phrase to display in the console
*/
public static final string PHRASE = "Hello World!";
/**
* Main method
*
* @params args Command line arguments
* @return void
*/
public static void main(String args[])
{
// Display "Hello world!" on the console.
System.out.println(PHRASE);
}
}
/**
* Hello world class
*
* Used to diplay the phrase "Hello World!" in a console.
*
* @author Sean
* @license LGPL
* @version 1.2
* @see System.out.println
* @see README
* @todo create factory methods
* @link https://github.com/sean/helloworld
*/
class HelloWorld
{
/**
* The default phrase to display in the console
*/
public static final string PHRASE = "Hello World!";
/**
* The phrase to display in the console
*/
private string hello_world = null;
/**
* Constructor
*
* @params hw The phrase to display in the console
*/
public hellowworld(string hw)
{
hello_world = hw;
}
/**
* Display the phrase "Hello World!" in a console
*
* @return void
*/
public void sayPhrase()
{
// Display "Hello world!" on the console.
System.out.println(hello_world);
}
/**
* Main method
*
* @params args Command line arguments
* @return void
*/
public static void main(String args[])
{
hello_world hw = new Helloworld(PHRASE);
try {
hw.sayPhrase();
} catch (Exception e) {
// DO NOTHING
}
}
}
/**
* Enterprise Hello world class v2.2
* Provides and enterprise ready, scalable business solution
* for displaying 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
* PARY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS
* PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLIDING
* DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
* LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
* DATA BEING 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
* @copyright Sean 2012
* @license LGPL
* @version 1.2
* @see System.out.println
* @see README
* @see license.txt
* @todo Test of OS compatibility
* @link https://github.com/sean/helloworld
*/
class HelloWorld
{
/**
* The first phrase
*/
public static final string PHRASE_HELLO = "Hello";
/**
* The second phrase
*/
public static final string PHRASE_WORLD = "World";
/**
* The first word in our phrase
*/
private word hello = null;
/**
* The second word in our phrase
*/
private word world = null;
/**
* Constructor
*
* @params hello First word to display in the console
* @params wolrd Second word to display in the console
*/
public hellowworld(word hello, word wolrd)
{
this.hello = hello;
this.world = wolrd;
}
/**
* Display the phrase "Hello World!" in a console
*
* @return void
*/
public void sayPhrase()
{
// Display "Hello world!" on the console.
string first = this.hello.toString();
string second = this.world.toString();
System.out.println(first + " " + second);
}
/**
* Sets the phrase to use for hello
*
* @param h the first phrase
* @return void
*/
public void setHello(string h)
{
this.hello.setWord(h);
}
/**
* Gets the phrase to use for hello
*
* @return hello
*/
public void getHello()
{
this.hello;
}
/**
* Sets the phrase to use for wolrd
*
* @param w the first phrase
* @return void
*/
public void setWorld(string w)
{
this.world.setWord(w);
}
/**
* Gets the phrase to use for world
*
* @return world
*/
public void getWorld()
{
this.world;
}
/**
* Main method
*
* @params args Command line arguments
* @return void
*/
public static void main(String args[])
{
// Create a new dic so we can display our phrase on the
// command line
DIC d = DependencyInjectionContainer::factory();
hello_world hw = null;
// Check for errors!
try {
hw = d.newInstance(Helloworld.class);
} catch (DICInstanceException $e) {
System.err.println("There was ana error creating an instance of Helloworld.");
return;
}
// Display the phrase on the command line.
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 an Console Error.");
} catch (Exception e) {
System.err.println("There was an unknown Error.");
}
}
}
<beans xmlns="http://www.framework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.framework.org/schema/context"
xsi:schemaLocation="http://www.framework.org/schema/beans
http://www.framework.org/schema/beans/beans-2.5.xsd
http://www.framework.org/schema/context
http://www.framework.org/schema/context/context-2.5.xsd">
<context:annotation-config />
<bean id="HelloworldBean" class="com.my-pragmatic-journey.beans">
<property name="hello" value="word" />
<property name="world" value="word" />
</bean>
/**
* Used to diplay the phrase "Hello World!" in a console.
*
* @author Sean
* @see README
*/
class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
source: https://medium.com/@webseanhickey/the-evolution-of-a-software-engineer-db854689243