title: My ListNode cannot return "null"
body: <p>I'm trying to write a program to find a node value in a linked list. I intended to let the program return the value when the value existed in the list and return <code>null</code> when it not existed in the list. But when I type the value(e.g. 4) that is not in the Linked List it cannot return <code>null</code>. </p>
  
  <pre><code> package com.company;
  
      /**
       * Created by Administrator on 2016/10/20 0020.
       */
      public class find {
          public static void main(String[] args){
              ListNode node1 = new ListNode(1);
              ListNode node2 = new ListNode(2);
              ListNode node3 = new ListNode(3);
  
              node1.next = node2;
              node2.next = node3;
  
              ListNode node = findNode(node1,4);
              System.out.println(node.val);
  
          }
  
          public static ListNode findNode(ListNode head, int val){
              for (ListNode node = head; node != null; node = node.next ){
                  if (node.val == val){
                      return node;
                  }
              }
              return null;
          }
      }
  
      class ListNode{
          int val;
          ListNode next;
          ListNode(int x){
                  val = x;
                  next = null;
          }
  
  
      }
  </code></pre>