I have been working in creating a B+ tree. I have certain problem in code. Please tell me what are the errors and how can I overcome it? I am giving the snippet where the error occurs.
class record { public int value; } class node { Object[] pointers ; int[] keys; node parent; boolean is_leaf; int num_keys; node next; record r; } node start_new_tree(int key, record pointer) { System.out.println(key+pointer.value); node root = d.makeleaf(); root.keys[0]=key; // The error is here.It gives null pointer exception root.pointers[0] = (Object)pointer; root.pointers[order - 1] = null; root.parent = null; root.num_keys++; //System.out.println(root.keys[0]+" "+root.pointers[0]+" "+root.num_keys); return root; }
When I use start_new_tree in my main,this gives nullpointer exception at the place mentioned.Can you tell me how to overcome this?
Thank you