class Plant{ public String shape="椭圆形"; private static String color="白色"; private String grow="黑土地"; public static void main(String[] args){ Friut f=new Friut(); f.print(); new Apple().main(args); } static class Fruit{ String taste; boolean iron; Friut(){ this.taste="酸"; this.iron=true; } System.out。println("叶子的形状:"+new Plant().shape); System.out.println("花的颜色"+color); System.out.println("生长的环境"+new Plant().grow); } } public class Apple extends Plant.Fruit{ Apple(String taste){ this.taste=taste; } Apple(){ super(); } public static void main(String[] args){ Apple apple=new Apple(); System.out.println("水果的味道:"+apple.taste); System.out.println("是否有何:"+apple.iron); } }
|