You get a java.lang.NullPointerException because you are trying to use public nodeobj array without creating their respective objects.

//change the node[] to static so as to use it in main()...