對(duì)應(yīng)代碼:
class Computer{
Stringbrand;
}
public class Student {
Stringname;
Integerage;
Computercomputer;
void study(){
System.out.println("我在學(xué)習(xí)亮钦,使用"+computer.brand);
}
void play(){
System.out.println("我在玩耍");
}
public static void main(String[] args) {
Student stu =new Student();
stu.name ="我們";
stu.age =18;
Computer computer =new Computer();
computer.brand ="聯(lián)想";
stu.computer = computer;
stu.study();
stu.play();
}
}