- class Employee{
- public Employee(){
- hello();
- }
- void hello() {
- System.out.println("Employee");
- }
- }
- class Boss extends Employee{
- public Boss(){
- hello();
- }
- @Override
- void hello() {
- System.out.println("Boss");
- }
- }
- public class Main {
- public static void main(String[] args) {
- Employee e = new Boss();
- }
- }
复制代码
|
|