标签:void static stat 子类 main user java面试 数据 dao
class X { Y b = new Y(); X() { System.out.print("X"); } } class Y { Y() { System.out.print("Y"); } } public class UserDao extends X{ Y y = new Y(); UserDao(){ System.out.print("Z"); } public static void main(String[] args) { new UserDao(); } }
先初始化父类数据,在初始化子类数据。结果 YXYZ
标签:void static stat 子类 main user java面试 数据 dao
原文地址:https://www.cnblogs.com/yanxiaoge/p/11161342.html