📄 phoneentry.java
字号:
/**
* Stores information for one phone entry. The following information
* is stored:
* <ol>
* <li>the name of a person, a <code>String</code>.</li>
* <li>the fixed telephone of a person, a <code>String</code>.</li>
* <li>the mobile telephone of a person, a <code>String</code>.</li>
* </ol>
*
* @author iCarnegie
* @version 1.0.0
*/
public class PhoneEntry {
/* Name of the entry */
private String name;
/* Fixed telephone of the entry */
private String fixed;
/* Mobile telephone of the entry */
private String mobile;
/**
* Constructs an <code>PhoneEntry</code> object.
*
* @param initialName the name of the person.
* @param initialFixed the fixed telephone of the person.
* @param initialMobile the mobile telephone of the person.
*/
public PhoneEntry (
String initialName,
String initialFixed,
String initialMobile) {
this.name = initialName;
this.fixed = initialFixed;
this.mobile = initialMobile;
}
/**
* Obtains the name of this entry.
*
* @return the name of this entry.
*/
public String getName() {
return this.name;
}
/**
* Obtains the fixed telephone number of this entry.
*
* @return the fixed telephone number of this entry.
*/
public String getFixed() {
return this.fixed;
}
/**
* Obtains the mobile telephone number of this entry.
*
* @return the mobile telephone number of this entry.
*/
public String getMobile() {
return this.mobile;
}
/**
* Returns the string representation of this entry in the following
* format: <i>name</i>_<i>F:fixed</i>_<i>M:mobile</i>
*
* @return the string representation of this entry.
*/
public String toString() {
String returnString = getName() + "_F:";
if (getFixed() != null) {
returnString += getFixed();
}
returnString += "_M:";
if (getMobile() != null) {
returnString += getMobile();
}
return returnString;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -