Class ConcreteSubject

java.lang.Object
Behavioral.Observer.Subject
Behavioral.Observer.ConcreteSubject

public class ConcreteSubject extends Subject
Concrete implementation of a Subject in the Observer pattern.
  • Constructor Details

    • ConcreteSubject

      public ConcreteSubject()
      Default constructor for ConcreteSubject.
  • Method Details

    • getState

      public String getState()
      Gets the state of the subject.
      Returns:
      The current state of the subject.
    • setState

      public void setState(String state)
      Sets the state of the subject and notifies observers.
      Parameters:
      state - The new state of the subject.