title: Exception java.lang.NullPointerException
body: <p>Iam working in a desktop application for windows version using java. In my application there is a requirement to search all .php</p>
  
  <p>i use recursive methods;</p>
  
  <p>and REGEX</p>
  
  <p>my code : </p>
  
  <pre><code>import java.io.File;
  
  
  public class Copier {
  public static void find(String source,String rep)
  {
      File src=new File(rep);
      if(src.exists() &amp;&amp; src.isDirectory())
      {
          String[] tab=src.list();
          for(String s:tab)
          {
              File srcc=new File(rep+"\\"+s);
              if(srcc.isFile())
              {  
                  if(srcc.getName().matches(".*"+source+"$"))
                  System.out.println(s);
              }
  
              else
                  find(source,srcc.getAbsolutePath());
          }
      }
  }
  
  public static void main(String[] args)
  {
      find(".php","C:\\");
  }
  }
  </code></pre>
  
  <p>But i have this exception :</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at Copier.find(Copier.java:11)
      at Copier.find(Copier.java:21)
      at Copier.main(Copier.java:28)
  </code></pre>