title: String Variable might not have been initialized
body: <p>Here is my code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class empMod
  
  {
  public static void main(String[] args)
      {
      int choice;
  
      Scanner input = new Scanner(System.in);
  
      do
          {
          choice = -1;
          System.out.println("Employee Data:");
          System.out.println("1. - Employee Name:");
          System.out.println("2. - Employee Hire Date:");
          System.out.println("3. - Employee Address:");
          System.out.println("4. - Employee Number:");
          System.out.println("5. - Exit");
  
          choice = input.nextInt();
          input.nextLine();
  
          switch (choice)
              {
              case 1:
  
              String empName = new String ();
              System.out.println("Enter the name of the employee:");
              String name = input.nextLine();
              break;
  
              case 2:
  
              String empDate = new String ();
              System.out.println("Enter the hire date of the employee:");
              String date = input.nextLine();
              break;
  
              case 3:
  
              String empAddress = new String ();
              System.out.println("Enter the address of the employee:");
              String address = input.nextLine();
              break;
  
              case 4:
  
              String empNumb = new String ();
              System.out.println("Enter the Employee number:");
              int number = input.nextInt();
              break;
  
              case 5:
  
              System.out.print("\n");
              System.out.println("The name of the employee is: " + empName); // &lt;-- This is the line where the error occurs.
              break;
  
              default:
              continue;
              }
  
          }
      while (choice != 6);
      } 
  }
  </code></pre>
  
  <p>The intent of the program is to have the user input information about the employee, and then at request, have the information displayed. When I go to compile the program, I get the following error:</p>
  
  <pre><code>empMod.java:57: error: variable empName might not have been initialized
                                  System.out.println("The name of the employee is:
   " + empName);
  
       ^
  </code></pre>
  
  <p>The string variable is initialized in another case though, so I am not sure of the problem.</p>