homework: using a loop to verify that a file doesn't exist
<pre><code>              String filename1; //file name to write to

    //get the file name to write to 
    System.out.println("\nEnter the filename for the file where the information will be stored:");
    filename1=keyboard.nextLine(); 
              File title1= new File(filename1);

    while (title1.exists()) //make sure the file doesn't exist
    {
        System.out.println("The file " + filename1 +" already exists.");
        System.out.println("Please choose another name.");
        System.out.println("Enter the filename:");
        filename1=keyboard.nextLine();
    }
</code></pre>

<p>once the loop is triggered by a filename that exists it keeps reiterating even after entering a file name that doesn't exist. why?</p>
