【发布时间】:2020-01-18 18:25:22
【问题描述】:
标题不是很有启发性,请指教一个更好的。
可以在 oca-java-se O'Reilly 中找到该示例。
我有一个基类
public class Thing{
public int thingOne;
public int thingTwo;
}
主要
class MyMain{
public static void main (String[] args){
Thing[] ta;
// how do I initialize this array
// is there a tricky way to access elements rather than ta[0] ??
}
}
我很困惑。我想这个教训是如何创建一个基类类型的数组,初始化它并从中访问元素。
【问题讨论】: