Firstly, Hi everyone that read this topic. I have to add an object to end of array. For instance in (public C(int,int,int) method) I have to extend array "array2" and array2 have two object for (A.B b1 = a1.new B();), have one object for (A.B b2 = a1.new B();).
How can I add object?
Thanks everyone very much.
The following code is in test class
<pre>public class Test{
public static void main(String[] args) {
A a1 = new A();
A.B b1 = a1.new B();
A.B b2 = a1.new B();
A.B.C c1 = b1.new C();
A.B.C c2 = b1.new C ();
A.B.C c3 = b2.new C();}}
//And the other class that following
<pre>public class A{
B [] array1;
class B{
C [] array2;
class C{
private int x;
private int y;
private int z;
//For each creating C object, array "array2" must be extended.
//add new C to end of array,How can I do?
public C(int x, int y, int z){
super();
this.x =x;
this.y=y;
this.z=z;
}
}
//for each creating B object, array "array1" must be extended.
//and add new B to end of array,How can I do that?
public B() {
super();
array2 = new C[0];
}}
public A() {
super();
array1 = new B[0];
}}