标签:bsp 计算机 pre 显示 相同 关联关系 public java代码 一对一
class Customer {
private Integer id;
private String name;
private Set<Order> orders;
public Set<Order> getOrders() {
return orders;
}
public void setOrders(Set<Order> orders) {
this.orders = orders;
}
}
class Order {
private Integer id;
private float money;
private Customer customer;
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
}
class Bicycle {
public void expand(Pump pump) {
pump.blow();
}
}
class Pump {
public void blow() {
System.out.println("正在充气......");
}
}
class Computer {
private MainBoard mainBoard;
private DisplayCard displayCard;
public void on() {
System.out.println("开启计算机......");
}
public void close() {
System.out.println("关闭计算机......");
}
public void run() {
System.out.println("计算机正在运行......");
}
}
class MainBoard {
public void control() {
System.out.println("控制计算机......");
}
}
class DisplayCard {
public void display() {
System.out.println("计算显示数据......");
}
}
class People {
private Head head;
private Hand hand;
private Leg leg;
public void think() {
head.think();
}
public void holdThing() {
hand.holdThing();
}
public void walk() {
leg.walk();
}
}
class Head {
public void think() {
System.out.println("思考......");
}
}
class Hand {
public void holdThing() {
System.out.println("拿东西......");
}
}
class Leg {
public void walk() {
System.out.println("走路......");
}
}
class People {
protected String name;
protected String sex;
protected Date birthday;
public void eat() {
System.out.println(name + "正在吃饭......");
}
public void drink() {
System.out.println(name + "正在喝水......");
}
public void sleep() {
System.out.println(name + "正在休息......");
}
}
class Student extends People {
public void study() {
System.out.println(name + "正在学习......");
}
}
public interface Driver {
void drive();
}
class CarDriver implements Driver {
public void drive() {
System.out.println("驾驶汽车......");
}
}
class PlaneDriver implements Driver {
public void drive() {
System.out.println("驾驶飞机......");
}
}
标签:bsp 计算机 pre 显示 相同 关联关系 public java代码 一对一
原文地址:http://www.cnblogs.com/huangjianping/p/7798564.html