java接口

//接口

public interface Comparable{

  int compareTo(Object other);

}

//实现

class Employee implements Comparable<Employee>{

  public int compareTo(Employee other){

    if(salary < other.salary)  return -1;

    if(salary > other.salary)  return 1;

    return 0

  }

}

 每个抽象类只能扩展一个类

posted @ 2017-03-27 16:59  kuqs(奇小东)  阅读(176)  评论(0)    收藏  举报