Put an array of Objects in nodes of another array of Objects [JAVA]
- by zengr
public class hello
{
public static void main(String[] args)
{
Object[] newarray = new Object[1];
Object[] obj = new Object[2];
obj[0] = "Number1"; //string value
obj[1] = "Number2"; //string value
newarray[0] = obj; //this works
Object[] tmp_obj = new Object[2];
tmp_obj = newarray[0]; //obviously does not work
System.out.println(tmp_obj[0]); //nope
System.out.println(tmp_obj[1]); //nope
}
}
So, now if I want to access the values "Number1" and "Number2" which are stored in obj[0] and obj[1]; obj is in newarray[0]. what should I do?
Is this a possible?
Thanks