C
Colin
Can someone show me why I am getting a null pointer exception from my
code. Here is a much simplified version:
class A {
private Vector<MyObject> foo;
public void func1() {
B.func2(this);
}
public void add(MyObject obj) {
foo.add(obj);
}
}
class B {
public static void func2(A obj) {
while (some condition) {
MyObject myObj = new MyObject();
obj.add(myObj);
}
}
}
If you are wondering, in my real program, class B parses an XML file
and creates the objects to add to A from the file.
Thanks,
Colin
code. Here is a much simplified version:
class A {
private Vector<MyObject> foo;
public void func1() {
B.func2(this);
}
public void add(MyObject obj) {
foo.add(obj);
}
}
class B {
public static void func2(A obj) {
while (some condition) {
MyObject myObj = new MyObject();
obj.add(myObj);
}
}
}
If you are wondering, in my real program, class B parses an XML file
and creates the objects to add to A from the file.
Thanks,
Colin