---
parents:
  - "[[Вопросы для собеседование Java]]"
---
```java
public class TextEditor {
    private SpellChecker checker;
    
    public TextEditor() {
        this.checker = new SpellChecker();
    }
    
    public void checkSpelling() {
        checker.checkSpelling();
    }
}
```

```java
public class TextEditor {
    private SpellChecker checker;
    
    public TextEditor(SpellChecker checker) {
        this.checker = checker;
    }
   
    public void checkSpelling() {
        checker.checkSpelling();
    }
}