简体   繁体   English

扩展Vector是什么意思 <Object> 在java中?

[英]What does it mean to extend a Vector<Object> in java?

For example, I have a class that says 例如,我有一堂课说

public class KeyList extends Vector<Object> {
}

but it never specifically creates a new Vector of any kind. 但它从未专门创建任何新的Vector。 This is part of an implementation of Eliza that I found online 这是我在网上找到的Eliza实施的一部分

extends means that KeyList is-a Vector . extends装置,其KeyList 是-一个 Vector It does not (necessarily) mean that KeyList has-a Vector . 它不(一定)是指KeyList 具有-一个 Vector

See The Java Tutorial for more, specifically What Is Inheritance? 有关更多信息,请参见Java教程,尤其是什么是继承? and the Inheritance section . 继承部分

It is about inheritance: meaning that KeyList is a subclass of Vector<Object> . 它与继承有关:意味着KeyListVector<Object>的子类。 Essentially it means that KeyList is a modified Vector<Object> in itself. 本质上,这意味着KeyList本身就是一个修改的Vector<Object> For more information, you should read Oracle's docs on inheritance. 有关更多信息,您应该阅读Oracle的继承文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM