title: Why do I receive the error "This method must return a result of type ..."?
body: <p>Can anyone see why I would receive the error "This method must return a result of type Card", when I clearly returns that variable "card" which is of type Card?</p>
  
  <pre><code>public Card playCard(int id){
      int i = 0;
      for (Card element : hand){
          if (i &lt;= hand.size())
          {           
              if (element.getID() == id)
              {
                  Card card = hand.get(i);
                  hand.remove(i);
                  return card;
              }
              else
              {
                  i++;
              }
  
          }
          else
          {
              throw new NullPointerException("Card does not exist in     hand");
          }
      }
  }
  </code></pre>