这是我需要的伪代码:
myArray = {
{Object, Object, Object},
{Object, Object, Object},
{Object, Object, Object},
{Object, Object, Object},
{Object, Object, Object},
}
如何在真正的 Java 中声明并初始化这样的东西?
最佳答案
就像这样...
Object[][] myArray = {
{obj11, obj12, obj13},
{obj21, obj22, obj23},
{obj31, obj32, obj33},
{obj41, obj42, obj43},
{obj51, obj52, obj53},
};
另请参阅Oracle's array tutorial .
关于Java 对象数组的数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8550298/