diff --git a/state/README.md b/state/README.md index 4f00ffcd8..14be4b022 100644 --- a/state/README.md +++ b/state/README.md @@ -49,7 +49,9 @@ public interface State { void observe(); } +``` +```java @Slf4j public class PeacefulState implements State { @@ -69,7 +71,9 @@ public class PeacefulState implements State { LOGGER.info("{} calms down.", mammoth); } } +``` +```java @Slf4j public class AngryState implements State { @@ -129,12 +133,15 @@ public class Mammoth { Here is the full example of how the mammoth behaves over time. ```java +public static void main(String[] args) { + var mammoth = new Mammoth(); mammoth.observe(); mammoth.timePasses(); mammoth.observe(); mammoth.timePasses(); mammoth.observe(); +} ``` Program output: @@ -146,10 +153,6 @@ Program output: The mammoth is calm and peaceful. ``` -## Class diagram - -![State](./etc/state_urm.png "State") - ## Applicability * An object's behavior depends on its state, and it must change its behavior at runtime depending on that state. diff --git a/state/src/main/java/com/iluwatar/state/App.java b/state/src/main/java/com/iluwatar/state/App.java index 9a973d220..12ee7871b 100644 --- a/state/src/main/java/com/iluwatar/state/App.java +++ b/state/src/main/java/com/iluwatar/state/App.java @@ -46,6 +46,5 @@ public class App { mammoth.observe(); mammoth.timePasses(); mammoth.observe(); - } }