继承多态的简单代码

 

 

 

class Employee{

}

class Leader extends Employee{

}

public class App{

       public static void main(String[] args){

               Employee e=new Employee();

               Leader l=new Leader();

               System.out.println(e instanceof  Employee);

               System.out.println(l  instanceof  Employee);

               System.out.println(e instanceof  Leader);

               System.out.println(l  instanceof  Leader);

       }

}

posted @ 2017-12-04 16:47  你可别玩了  阅读(130)  评论(0编辑  收藏  举报