我在 Name 类中创建了一个 Name 对象,在 Address 类中创建了一个 Address 对象。我可以结合这两个对象在 MailingLabel 类中创建一个 MailingLabel 对象吗?
头等舱
public class Name
{
private String firstName;
private char middleInitial;
private String lastName;
public Name (String fn, char mi, String ln)
{
firstName = fn;
middleInitial = mi;
lastName = ln;
}
二等舱
public class Address
{
private int streetNumber;
private String streetName;
private String streetType;
private String city;
private String state;
private int zip;
public Address (int snum, String sn, String st, String c, String s, int z)
{
streetNumber = snum;
streetName = sn;
streetType = st;
city = c;
state = s;
zip = z;
}
MailingLabel 的目标是打印出一个看起来像
Millicent X Feniwick
1600 Huckleberry Lane
Chelsea, NJ 15483
30秒到达战场
相关分类