⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 person.java

📁 01 Java入门 benin 01 Java Introduction to Benin
💻 JAVA
字号:
public class Person {
	protected String fullName;
	protected String firstName, lastName;
	/** Construct a Person using his/her first+last names. */
	public Person(String firstName, String lastName) {
		this.firstName = firstName;
		this.lastName = lastName;
	}
	/** Get the person's full name */
	public String getFullName( ) {
		if (fullName != null)
		return fullName;
		return firstName + " " + lastName;
	}
	/** Simple test program. */
	public static void main(String[] argv) {
		Person p = new Person("Ian", "Darwin");
		String f = p.getFullName( );
		if (!f.equals("Ian Darwin"))
		throw new IllegalStateException("Name concatenation broken");
		System.out.println("Fullname " + f + " looks good");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -