0

I am trying to copy variables of the same class type

FUNCTION[] funcs;
FUNCTION[] orphelines;

as follows

orphelines[nb_orphelines]=funcs[numero];

Is = right for this task? I get a NullPointer error....

Hans
  • 331
  • 1
  • 3
  • 8
  • Then either `orphelines` or `funcs` (or both) is `null`. But only if you post a MCVE someone can give a definite answer. – Ctx Apr 29 '16 at 10:14
  • Sure, orphelines[nb_orphelines] is null. That's the idea: to pass funcs[numero] to orphelines[nb_orphelines], taking into account that FUNCTION[] holds inner functions. – Hans Apr 29 '16 at 10:25
  • No, `orphelines` is `null`, not `orphelines[nb_orphelines]`. In other words, there is no array at all. Somewhere you need to create the array, for example : `orphelines = new orphelines[100];` – Jesper Apr 29 '16 at 10:27
  • You have to make a distinction between the array (as a container) and the elements stored in it. You must first create _the container_ (i.e. by calling `orphelines = new orphelines[funcs.length];` or similar). Then you can start populating it. – Ctx Apr 29 '16 at 10:28

0 Answers0