title: "Missing Return Statement", with while loop
body: <p>This code is encountering a return error. I would appreciate being told how to fix it and more importantly than the former explain why it is necessary to do so. My professor did a pretty shotty job of explaining how a lot of things worked so now I feel like I need to learn a lot that should be known already. Thank you everyone!</p>
  
  <pre><code>import java.io.*;               //Imports any file operation (ie Reading or Writing)
  import java.util.Scanner;       //Imports scanner class
  import javax.swing.JOptionPane; //Import JOptionPane to allow dialog boxes
  
  public class program7
  {
      public String MakeFile() throws IOException
      {
          String NameofDataFile, inputted_text, temp, e;
  
          temp = "";
  
          NameofDataFile=JOptionPane.showInputDialog("Enter the name of the file to be opened: ");    //creates file with entered name
  
          /*allows file to be written in*/
          PrintWriter FileObj = new PrintWriter (new FileWriter (NameofDataFile));
  
          inputted_text=JOptionPane.showInputDialog("Enter a String: ");                                    //asks user for a string
          e = inputted_text;
  
          while (e == temp)
  
              return null;
      }
  
  }
  </code></pre>