title: Why does my Java code not compile?
body: <p>I have this fragment of code:</p>
  
  <pre><code>@RequestMapping(value = "/addQuestion", method = RequestMethod.POST)
  public String addQuestion(){
      ViewController viewController ;
      viewController.createQuestion(int questionId, String theQuestion, String category, String correctAnswer);
      return "qFour";
  }
  </code></pre>
  
  <p>and the line beginning 'viewController.createQuestion' is underlined in red saying variable <code>'viewController' might not have been initialized</code>.</p>
  
  <ol>
  <li>when I try <code>ViewController viewController = null;</code> (i.e. initializing it, it complains again for another reason)</li>
  <li>why does it need initializing? </li>
  <li>can someone instruct me what is syntactically wrong with this code?</li>
  </ol>