25 lines
488 B
Markdown
25 lines
488 B
Markdown
|
---
|
||
|
parents:
|
||
|
- "[[Вопросы для собеседование Java]]"
|
||
|
---
|
||
|
```java
|
||
|
public class Application {
|
||
|
private Service service;
|
||
|
|
||
|
public Application(Service service) {
|
||
|
this.service = service;
|
||
|
}
|
||
|
|
||
|
public void start() {
|
||
|
service.serve();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public class App {
|
||
|
public static void main(String[] args) {
|
||
|
Service service = new ServiceImpl();
|
||
|
Application app = new Application(service);
|
||
|
app.start();
|
||
|
}
|
||
|
}
|
||
|
```
|