title: I keep getting "FileNotFoundException" even though I handled the exception and the file does exist.
body: <pre><code>Scanner read=new Scanner(file);
  </code></pre>
  
  <p>the exception "FileNotFoundException" occurs in this statement.</p>
  
  <pre><code>  import java.util.*;
    import java.io.*;
  
    public class shoppingList {
  
          public static void main(String []args)throws IOException {
  
                File file=new File("MyList.txt");
  
                try {
  
                     if(file.exists()==false)
                      throw new FileNotFoundException("the file input doesn't exist");
                }
                catch(FileNotFoundException e){System.out.print(e.getMessage());}
  
                //I tried handling the exception but it didn't work
  
                Scanner read=new Scanner(file);
  
  
                File outfile=new File("MyReceipt.txt");
                FileOutputStream fos=new FileOutputStream(outfile);
                PrintWriter output=new PrintWriter(fos);
  
                while(read.hasNext()) {
                   String item=read.next();
                   double price=read.nextDouble();
                   String status=read.next();
  
                   output.println("My Receipt: ");
                   output.println("--------------------");
  
                   if(status.equals("Done")==true)
                      output.println(item+"  "+price);
  
  
                   double total=0;
  
  
                   total+=price;
                   output.println("--------------------");
                   output.println("total= "+total);
               }
  
               read.close();
               output.close();
        }
   }
  </code></pre>