JAVA 问题:为什么 程序最后的三句 会输出 如下的结果???求解释
程序publicclassPersonProject{publicstaticvoidmain(String[]args){Personp1;Personp2;Perso...
程序
public class PersonProject {
public static void main(String[] args) {
Person p1;
Person p2;
Person p3;
p1 = new Person("Chris", "M", "SIP");
p2 = new Person("Fred", "M", "Shanghai");
p3 = new Person("Gloria", "F", "Beijing");
System.out.println("Objects in class Person:");
System.out.println(p1.toString());
System.out.println(p2.toString());
System.out.println(p3.toString());
} }
OUT PUT
Objects in class Person:
Person [name=Chris, gender=M, address=SIP, idNumber=1] Person [name=Fred, gender=M, address=Shanghai, idNumber=2] Person [name=Gloria, gender=F, address=Beijing, idNumber=3] 展开
public class PersonProject {
public static void main(String[] args) {
Person p1;
Person p2;
Person p3;
p1 = new Person("Chris", "M", "SIP");
p2 = new Person("Fred", "M", "Shanghai");
p3 = new Person("Gloria", "F", "Beijing");
System.out.println("Objects in class Person:");
System.out.println(p1.toString());
System.out.println(p2.toString());
System.out.println(p3.toString());
} }
OUT PUT
Objects in class Person:
Person [name=Chris, gender=M, address=SIP, idNumber=1] Person [name=Fred, gender=M, address=Shanghai, idNumber=2] Person [name=Gloria, gender=F, address=Beijing, idNumber=3] 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询