2 Star 0 Fork 0

CS-IMIS-23/20172302侯泽洋

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
Contact.java 662 Bytes
Copy Edit Raw Blame History
20172302 authored 2018-10-14 14:48 +08:00 . 第九章排序与查找课本代码
package chapter9;
public class Contact implements Comparable<Contact>
{
private String firstName, lastName, phone;
public Contact(String first, String last, String telephone)
{
firstName = first;
lastName = last;
phone = telephone;
}
public String toString()
{
return lastName + ", " + firstName + "\t" + phone;
}
@Override
public int compareTo(Contact other) {
int result;
if (lastName.equals(other.lastName))
result = firstName.compareTo(other.firstName);
else
result = lastName.compareTo(other.lastName);
return result;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/Java-pro.git
git@gitee.com:CS-IMIS-23/Java-pro.git
CS-IMIS-23
Java-pro
20172302侯泽洋
master

Search