初始化时你称之为超类和子类? [英] What do you call the superclass and subclass when initializing?
本文介绍了初始化时你称之为超类和子类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
List<String> list = new ArrayList<String>();
在识别除超类和子类之外的部分时,List和ArrayList是什么?
What is List and ArrayList when identifying the parts besides super class and subclass?
列表是引用而ArrayList是类吗?
Is List the reference and ArrayList the class?
如果它们是相同的,它们会被调用吗:
Would they be called something else if they were the same like:
ArrayList<String> list = new ArrayList<String>();
推荐答案
此声明分为三部分:
- 命名参考(
列表
) - 编译时,引用的静态类型(
List< String>
) - 运行时,引用的动态类型(
ArrayList< String>
)
- A named reference (
list
) - The compile time, static type of the reference (
List<String>
) - The run time, dynamic type of the reference (
ArrayList<String>
)
无论如何,每个部分都将保留其角色你修改了编译时类型。
Each of those pieces would retain their character regardless of how you modified the compile time type.
List
是一个接口; ArrayList
是该接口的实现。
List
is an interface; ArrayList
is an implementation of that interface.
这篇关于初始化时你称之为超类和子类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文