title: Java code not working - don't know the source of the error?
body: <p>I am making a quiz with Java, and an error has appeared. When I enter in the <em>right</em> answer, it says it is wrong. Any ideas?</p>
  
  <p>Code:</p>
  
  <pre><code>package revision_project;
  
  import java.util.List;
  import java.util.Scanner;
  import java.util.ArrayList;
  
  
  public class Quiz {
      public static void main(String args[]){
          String newline = System.getProperty("line.separator");
          Scanner input = new Scanner(System.in);
  
          String[] questions = {"What is an integer?", "What does CPU stand for?", "How far can a LAN go?",
                  "What does LAN stand for?", "Give an example of a WAN.", "What is a syntax error?"};
          String[] answers = {"a whole number", "central processing unit", "2km", "local area network",
                  "internet", "when the programmer enters in incorrect syntax."};
          List&lt;String&gt; correct = new ArrayList&lt;String&gt;();
  
          for(int i = 0; i &lt; questions.length; i++){
              System.out.println(questions[i] + ": " + newline);
              String x = input.nextLine();
              x = x.toLowerCase();
  
              if(x == answers[i]){
                  System.out.println("Correct");
                  //correct.add("Correct");
              } else{
                  System.out.println("Wrong");
                  //correct.add("Wrong");
              }
          }               
      }
  }
  </code></pre>