Files
java-design-patterns/composite/src/main/java/com/iluwatar/App.java

26 lines
619 B
Java
Raw Normal View History

2014-08-13 21:14:03 +03:00
package com.iluwatar;
2014-08-31 09:03:10 +03:00
/**
*
* With Composite we can treat tree hierarchies of objects with uniform
* interface (LetterComposite). In this example we have sentences composed of
* words composed of letters.
*
2014-08-31 09:03:10 +03:00
*/
public class App {
public static void main(String[] args) {
System.out.println("Message from the orcs: ");
LetterComposite orcMessage = new Messenger().messageFromOrcs();
orcMessage.print();
System.out.println("\n");
System.out.println("Message from the elves: ");
2014-08-13 21:14:03 +03:00
LetterComposite elfMessage = new Messenger().messageFromElves();
elfMessage.print();
}
2014-08-13 21:14:03 +03:00
}