/**
@author lyc
*/
public interface Life {
//做了什么事情
public void dosomething(String thing);
//什么时间做的
public void getTime(Data time);
//感想
public void getMind(String mind);
}
--------------------------------------
import java.util.List;
import javax.xml.crypto.Data;
/**
@author lyc
*/
public class Happy {
//时间
private Data happytime;
//地点
private String address;
//内容
private String content;
//心得
private String mind;
public Data getHappytime() {
return happytime;
}
public void setHappytime(Data happytime) {
this.happytime = happytime;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getMind() {
return mind;
}
public void setMind(String mind) {
this.mind = mind;
}
}
------------------------------------------------------------
import javax.xml.crypto.Data;
/**
* @author lyc
*/
public class HolidayLife implements Life {
// 找了什么乐子
private Happy happy;
public HolidayLife() {
}
public HolidayLife(Happy h) {
this.happy = h;
}
@Override
public void dosomething(String thing) {
happy.setContent(thing);
}
@Override
public void getTime(Data time) {
happy.setHappytime(time);
}
@Override
public void getMind(String mind) {
happy.setMind(mind);
}
public void showHappy() {
if(happy.getHappytime()!=null){
System.out.println(happy.getHappytime());
}
System.out.println(happy.getContent());
System.out.println(happy.getMind());
}
}
--------------------------------------------------------------------
import javax.xml.crypto.Data;
/**
* @author lyc
*/
public class StudyLife implements Life {
// 找了什么乐子
private Happy happy;
public StudyLife() {
}
public StudyLife(Happy h) {
this.happy = h;
}
@Override
public void dosomething(String thing) {
happy.setContent(thing);
}
@Override
public void getTime(Data time) {
happy.setHappytime(time);
}
@Override
public void getMind(String mind) {
happy.setMind(mind);
}
public void showHappy() {
System.out.println(happy.getHappytime());
System.out.println(happy.getContent());
System.out.println(happy.getMind());
}
}
---------------------------------------------------------------
/**
@author lyc
*/
public class Heima {
//黑马是我们的开始
public static void main(String[] args) throws InterruptedException {
HolidayLife holidayLife = new HolidayLife(new Happy());
holidayLife .dosomething("一起出去骑车,哐哐哐,一起骑到一个很多小花开的山腰上,然后一起"
+ "搬出了直径40米的大铁锅,再掏出40米长的大菜刀---------煮火锅!!");
holidayLife.getMind("<input type=/'hidden'/>手动滑稽:跟寝室的子孙们共享天伦之乐<input>");
holidayLife.showHappy();
System.out.println("以上是个hiddden域,子孙用户们是看不见滴!!!");
StudyLife studyLife = new StudyLife(new Happy());
studyLife.dosomething("早上7点40我的脑子就开始bilibili,先看看肖同学有没有从被子里露"
+ "头,然后再看看床下有没有动静,然后起床ing()");
//我的线程已经睡着了。。。
Thread.sleep(10000);
//肖同学掀起了我的被子一角(请同学们不要这样睡10000毫秒,不然会很惨)
Thread.currentThread().notifyAll();
studyLife.getMind("凭什么李鑫睡得跟猪一样,到教师比我们早????");
studyLife.showHappy();
System.out.println("以上黑人问号!");
System.out.println("ps:很多地方完善不了,因为我很忙呀。。。呀。。。呀!");
}
} |
|