代码:
public static void main(String[] args) {
Car car=new Car(80);
car.getAir().flow();
}
class Car{
private double temperature;
public Car(double temperature) {
this.temperature = temperature;
}
class Air{
public void flow(){
if (temperature>40){
System.out.println("空调正在吹冷风~");
}else if (temperature<0){
System.out.println("空调正在吹暖风~");
}else {
System.out.println("空调正在关闭");
}
};
}
public Air getAir(){
return new Air();
}
}