/*第二个问题: 题目要求建一个二维数组,而且第二层的数组要求动态建立,这也不难,java中数组都是当作对象来操作,只要在原一层数组的某个元素中放入一个指向另一个数组的对象即可,当然这个新的数组对象按要求要即时生成 */public class Ok { int [][] x; public static void main(String s[]) { Ok t = new Ok(); t.x = new int[10][]; int [] xx = new int[10]; //这里实现the other arrays are constructed as needed t.x[1] = xx; }}
题目要求建一个二维数组,而且第二层的数组要求动态建立,这也不难,java中数组都是当作对象来操作,只要在原一层数组的某个元素中放入一个指向另一个数组的对象即可,当然这个新的数组对象按要求要即时生成
*/public class Ok
{
int [][] x;
public static void main(String s[])
{
Ok t = new Ok();
t.x = new int[10][]; int [] xx = new int[10]; //这里实现the other arrays are constructed as needed
t.x[1] = xx;
}}