title: Search string in file and return next line (in Java)
body: <p>As my title says. I need to search through a file for a string. When its found, I need the next line.
  It's a file like this:</p>
  <blockquote>
  <p>hello</p>
  <p>world</p>
  </blockquote>
  <p>When &quot;hello&quot; is found, &quot;world&quot; needs to be returned.</p>
  <pre><code>File file = new File(&quot;testfile&quot;);
  Scanner scanner = null;
  try {
    scanner = new Scanner(file);
  } catch (FileNotFoundException e) {
    e.printStackTrace();
  }
  
  if (scanner != null) {
    String line;
    while (scanner.hasNextLine()) {
      line = scanner.nextLine();
      if (line == &quot;hello&quot;) {
        line = scanner.nextLine();
        System.out.println(line);
      }
    }
  }
  </code></pre>
  <p>It reads through the file but it doesn't find the word &quot;hello&quot;.</p>