public void method(Employee e) { if (e instanceof Manager) { Manager m = (Manager)e; System.out.println( " This is the manager of " + m.department); } // rest of operation }//源代码片段来自云代码http://yuncode.net