不是说子类可以继承父类的属性么?为什么我这样写结果还是0?
public class Transport { public int site; public void print() { System.out.println("这辆车可以乘坐"+site+"人"); } }
public class Bus extends Transport { public int site = 20; }
public class Initail { public static void main(String[] args) { Bus bus = new Bus(); bus.print(); } }