digital-garden/notes/Собеседования/Задачи/Задача 22.md

31 lines
550 B
Markdown
Raw Normal View History

2024-06-13 21:01:37 +03:00
---
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();
}
}