S
sunstormrider
Dear group
This is driving me nuts - I thought I had it working and then not.
I have 2 classes - "tester" and "support"
support has two instance variables:
private int[] x
private int[] y
and a constructor something like this:
public support(int[] c, int[] d)
{
for (int i=0; i<x.length; i++)
{
x = c;
}
for (int i=0; i<y.length; i++)
{
y = d;
}
}
and support compiles fine.
Trouble is, when I come to pass the arguments to support from tester I
get a NullPointerException
E.g. in tester I have
int[] j = {1,2,3,4,5,6};
int[] k = {0,1,2,3,4,5};
support fred = new support(j,k)
and it's the creation of the fred object that's giving me the runtime
error. This must be a simple thing but I can't spot it anywhere.
Sun
This is driving me nuts - I thought I had it working and then not.
I have 2 classes - "tester" and "support"
support has two instance variables:
private int[] x
private int[] y
and a constructor something like this:
public support(int[] c, int[] d)
{
for (int i=0; i<x.length; i++)
{
x = c;
}
for (int i=0; i<y.length; i++)
{
y = d;
}
}
and support compiles fine.
Trouble is, when I come to pass the arguments to support from tester I
get a NullPointerException
E.g. in tester I have
int[] j = {1,2,3,4,5,6};
int[] k = {0,1,2,3,4,5};
support fred = new support(j,k)
and it's the creation of the fred object that's giving me the runtime
error. This must be a simple thing but I can't spot it anywhere.
Sun