不同温度检测空调运转情况
public class Homework07 { public static void main(String[] args) { Car temperature1 = new Car(60); temperature1.getAir().flow(); } } package com.hspedu.Homework07; import com.sun.org.apache.bcel.internal.generic.NEW; public class Car { private double temperature; public Car(double temperature) { this.temperature = temperature; } ; //成员内部类 class Air { public void flow() { if (temperature < 0) { System.out.println("开始吹暖风。。。"); } else if (temperature > 40) { System.out.println("开始吹冷风。。。"); } else { System.out.println("温度正常,关闭空调"); } } } //写一个方法,返回创建Air public Air getAir() { return new Air(); } }