I try many coding to solve the question bellow but also cannot find the answer. Can anyone help me solve my problem and tell me where is the wrong coding??
/** Task: Recusively counts the nodes in a chain.
* @param start the first node
* @returns the number of nodes in the linked chain */
public int countNodes(Node start)
{
if (start == null)
// base case
{
countNodes (Node start);
// recursive case
else
System.out.println (start.data);
return start.next;
}
} // end countNodes