2020.7.17
阿新 • • 發佈:2020-07-18
一、今日學習內容
1、第四章綜合例項
1 package com.wuzy.entity; 2 public class Person { 3 private String name; 4 private int age; 5 public String getName() { 6 return name; 7 } 8 public void setName(String name) { 9 this.name=name; 10 } 11 public int getAge() { 12return age; 13 } 14 public void setAge(int age) { 15 this.age=age; 16 } 17 }
1 package com.wuzy.service; 2 import com.wuzy.entity.Person; 3 public class Service { 4 public static void main(String[] args) { 5 Person p=new Person(); 6 p.setName("張無忌");7 p.setAge(20); 8 Person p2=new Person(); 9 p2.setName("伍正雲"); 10 p2.setAge(30); 11 Person[] ps= {p,p2}; 12 for(int i=0;i<ps.length;i++) 13 { 14 System.out.println(ps[i].getName()+","+ps[i].getAge()); 15 } 16 } 17 }
輸出結果:張無忌,20
伍正雲,30
二、今日遇到的問題
今日複習了第四章的內容,沒有遇到問題
三、明日計劃
學習第五章的內容