java - Outputting null -
I am having a problem in which the output of the list (n + 1) returns empty output rather than returning . Is there something I see?
Public Stable ListEnginement Millitem (Listmill Head, Int N) {if (n == 0) {return head; } And if (head == zero) {return tap; } And {return getItem (head.getNext (), n + 1); }}
This code does not understand. If the head is not empty, then it will call getItem (head.getNext (), n + 1) , but in the end, head will be null < / Code> (and n will never go to) and so it will return you null maybe you mean return getItem (head .getNext (), n-1) .
Comments
Post a Comment