一、今日学习内容:第四章习题练习。

对两个类分别定义

(1)

package com.wuzy.entity;
public class Person {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name=name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age=age;
}
}

(2)

package com.wuzy.service;
import com.wuzy.entity.Person;
public class Service {
public static void main(String[] args) {
Person p=new Person();
p.setName("张无忌");
p.setAge(20);
Person p2=new Person();
p2.setName("伍正云");
p2.setAge(30);
Person[] ps= {p,p2};
for(int i=0;i<ps.length;i++)
{
System.out.println(ps[i].getName()+","+ps[i].getAge());
}
}
}

输出结果是: 张无忌,20

                    伍正云,30

二、遇到的问题:

   无。

三、明日学习计划:

   进行周报总结,继续阅读《大道至简》。

 

posted on 2020-07-18 21:20  白日梦想家~  阅读(96)  评论(0编辑  收藏  举报