对应代码:
class Computer{
Stringbrand;
}
public class Student {
Stringname;
Integerage;
Computercomputer;
void study(){
System.out.println("我在学习,使用"+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 ="联想";
stu.computer = computer;
stu.study();
stu.play();
}
}