I'm kind of new to Java and I've had trouble working with object arrays, the answer is probably pretty simple but I can't see it.
I have a class named Vectors and a function named set_components() What I try to do is create an array of objects like this:
Vectors[] vec = new Vectors[2];
//Then access the function like this:
vec[0].set_components();
However I get this error: Exception in thread "main" java.lang.NullPointerException why is that?
It works if I just do this for one object.
Vector vec = new Vector();
vec.set_components();