我在一个名为 util 的包中有三个类,都是公共类。但是,当我尝试编译使用这些类的代码时,我收到一个错误,指出这些类不是公共的。我不知道怎么了。三类如下:
package util;
class Address {
private String address;
public Address(){
address = "Default";
}
public Address(String newAddress){
address = newAddress;
}
public void setAddress(String newAddress){
address = newAddress;
}
public String getAddress(){
return address;
}
}
日期类
package util;
class Date {
private String Date;
public Date(){
Date = "Default";
}
public Date(String newDate){
Date = newDate;
}
public void setDate(String newDate){
Date = newDate;
}
public String getDate(){
return Date;
}
}
名称类
package util;
class Name {
private String name;
public Name(){
name = "Default";
}
public Name(String newName){
name = newName;
}
public void setName(String newName){
name = newName;
}
public String getName(){
return name;
}
}