31 lines
550 B
Markdown
31 lines
550 B
Markdown
---
|
|
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();
|
|
}
|
|
}
|