title: Linked list, count even and uneven positions, unsing recursion
body: <p>I want to create two methods, "private int sumEven (Node node){}" for suming up even positions in a linked list and "sumOdd (Node node) {}" for suming up odd positions. I want to use recursion.</p>
  
  <p>This is how far i've come, but i dont know what should I do next.
  Does any one have a tipp or a hint for me, what should i do next?</p>
  
  <pre><code>public class RecursiveListTest {
     static Node head;
     static boolean found = false;
     static int counter = 0;
  
     public static void main(String[] args) {
         RecursiveListTest list = new RecursiveListTest();
  
         list.addNumber(3);
         list.addNumber(5);
         list.addNumber(2);
         list.addNumber(7);
         list.addNumber(5);
         list.addNumber(1);
         list.addNumber(4);
         list.printList();
  
         int sumEven = list.sumEven(head);
         int sumOdd = list.sumOdd(head);
  
         System.out.println();
         System.out.println("Sum of even Positions: " + sumEven);
         System.out.println();
         System.out.println("Sum of odd Positions: " + sumOdd);
         System.out.println();
     }
  
     // Node
     private class Node {
         Node next;
         int value;
  
         Node(int value, Node next) {
             this.value = value;
             this.next = next;
         }
     }
  
     private int sumEven(Node n) {
         int sumEven = 0;
         int sumOdd = 0;
  
         counter = counter + 1;
  
         if (counter % 2 == 0) {
             sumEven = sumEven + n.value;
             if (n.next.next != null) {
                 sumEven = sumEven + sumEven(n.next.next);
             }
         }
  
         else if (counter % 2 == 1) {
             if (n.next != null) {
                 sumEven = sumEven + sumEven(n.next);
             }
         }
  
         return sumEven;
     }
  
     private int sumOdd(Node n) {
         return 0;
     }
  
     private void addNumber(int number) {
         Node curr = head;
         Node prev = null;
  
         if (head == null) {
             head = new Node(number, null);
         } else {
             while (curr != null) {
                 prev = curr;
                 curr = curr.next;
             }
  
             Node newNode = new Node(number, null);
             prev.next = newNode;
         }
     }
  
  
  
     private void printList() {
         Node curr = head;
         Node prev = null;
  
         while (curr != null) {
             System.out.print(curr.value + " ");
  
             prev = curr;
             curr = curr.next;
         }
     }
  }
  </code></pre>