Java案例:Comparable接口用法

1、Employee

Java案例:Comparable接口用法_第1张图片

package net.hw.interfaces;

/**
 * Created by howard on 2018/1/29.
 */
public class Employee implements Comparable {
    private String name;
    private double salary;

    public Employee() {
    }

    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public int compareTo(Employee o

你可能感兴趣的:(Java编程)