Just formatting App classes to be like the other class files on the project
This commit is contained in:
@ -1,23 +1,22 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Strategy (DragonSlayingStrategy) encapsulates the algorithm to use.
|
||||
* The object (DragonSlayer) can alter its behavior by changing its strategy.
|
||||
*
|
||||
* Strategy (DragonSlayingStrategy) encapsulates the algorithm to use. The
|
||||
* object (DragonSlayer) can alter its behavior by changing its strategy.
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println("Green dragon spotted ahead!");
|
||||
DragonSlayer dragonSlayer = new DragonSlayer(new MeleeStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
System.out.println("Red dragon emerges.");
|
||||
dragonSlayer.changeStrategy(new ProjectileStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
System.out.println("Black dragon lands before you.");
|
||||
dragonSlayer.changeStrategy(new SpellStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Green dragon spotted ahead!");
|
||||
DragonSlayer dragonSlayer = new DragonSlayer(new MeleeStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
System.out.println("Red dragon emerges.");
|
||||
dragonSlayer.changeStrategy(new ProjectileStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
System.out.println("Black dragon lands before you.");
|
||||
dragonSlayer.changeStrategy(new SpellStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user