title: Initializing String variable in if-else
body: <p>I'm trying to write a program here, and in my if-else statement I have <code>String messageToStudent</code> initialize if <code>taskCompleted == 'y' || taskCompleted == 'Y'</code> , and in my else statement to initialize it for anything else.  however, when I try to compile it says that <code>messageToStudent</code> may have not been initialized.  Now, I thought I made it through the code that ONE of the <code>messageToStudent</code> strings would initialize, but I guess I was wrong.  Here's what I have so far:</p>
  
  <pre><code>if(school == 1) {
      System.out.println(name + ", have you started your engineering project yet?");
      taskCompleted = scan.nextLine().charAt(0);
      if (taskCompleted == 'y' || taskCompleted == 'Y')
          messageToStudent = "Good for you! Keep me updated on your progress.";
      System.out.println(messageToStudent);
  } else {
      messageToStudent = "That's not good at all. It's nearly November!";
  }
  System.out.println(messageToStudent);
  </code></pre>