mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 21:25:52 +00:00
local variable type inference changes (#1040)
local variable type inference changes for strategy design pattern
This commit is contained in:
@@ -51,7 +51,7 @@ public class App {
|
||||
public static void main(String[] args) {
|
||||
// GoF Strategy pattern
|
||||
LOGGER.info("Green dragon spotted ahead!");
|
||||
DragonSlayer dragonSlayer = new DragonSlayer(new MeleeStrategy());
|
||||
var dragonSlayer = new DragonSlayer(new MeleeStrategy());
|
||||
dragonSlayer.goToBattle();
|
||||
LOGGER.info("Red dragon emerges.");
|
||||
dragonSlayer.changeStrategy(new ProjectileStrategy());
|
||||
|
||||
Reference in New Issue
Block a user