28 lines
475 B
Markdown
28 lines
475 B
Markdown
---
|
|
parents:
|
|
- "[[Вопросы для собеседование Java]]"
|
|
---
|
|
```java
|
|
public class Train {
|
|
public static void main(String[] args) {
|
|
final ClassOne classOne = new ClassTwo();
|
|
System.out.println(classOne.method());
|
|
}
|
|
}
|
|
|
|
class ClassOne {
|
|
public static String method() {
|
|
return "ClassOne";
|
|
}
|
|
}
|
|
|
|
class ClassTwo extends ClassOne {
|
|
public static String method() {
|
|
return "ClassTwo";
|
|
}
|
|
}
|
|
```
|
|
|
|
%%
|
|
ClassOne
|
|
%% |