正确。示例中的每个类都有其自己的int IDid字段。
您可以通过以下方式从子类中读取或分配值:
super.ID = ... ; // when it is the direct sub class((Person) this).ID = ... ; // when the class hierarchy is not one level only
或在外部(当它们是公开的时):
Student s = new Student();s.ID = ... ; // to access the ID of Student((Person) s).ID = ... ; to access the ID of Person



