title: Package does not exist error though i have imported it
body: <p>I have a directory structure com/example/web with BeerSelect.java file in it. </p>
  
  <h2>BeerSelect.java</h2>
  
  <pre><code>package com.example.web;
  
  import com.example.model.*;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  import java.util.*;
  
  public class BeerSelect extends HttpServlet{
  public void doPost(HttpServletRequest request,HttpServletResponse     response) throws IOException, ServletException
  {
      ArrayList&lt;String&gt; brandsFromExpert = new ArrayList&lt;String&gt;();
  
      BeerExpert expert = new BeerExpert();
  
      String c = "light"
  
      brandsFromExpert = expert.getBrands(c);
  }
  }
  </code></pre>
  
  <p>And I have another file in the directory com/example/model with BeerExpert.java file in it.</p>
  
  <h2>BeerExpert.java</h2>
  
  <pre><code>   package com.example.model;
  
     import java.util.*;
  
     public class BeerExpert{
  
     public List getBrands(String color)
     {
      List&lt;String&gt; brands = new ArrayList&lt;String&gt;();
  
      if(color.equals("amber"))
          brands.add("JacK Amber");
      else
          brands.add("Jail Pale Ale");
  
      return brands;
     }
    } 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/IPkup.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPkup.png" alt="Directory Structure"></a></p>
  
  <p>But when I try to compile the BeerSelect.java I get the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/UuoBS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UuoBS.png" alt="Error Screenshot"></a></p>
  
  <p>Can anyone please tell why?</p>