title: How to read a specific word in text file and use a condition statement to do something
body: <p>I'm new to coding in java. Can anyone help me with my codes? I'm currently making a program where you input a string in a jTextArea, and if the input word(s) matches the one in the text file then it will then do something.</p>
  
  <p>For example: I input the word 'Hey' then it will print something like "Hello" when the input word matches from the text file.</p>
  
  <p>I hope you understand what I mean.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>String line;
      String yo;
      yo = jTextArea2.getText();
  
      try (
          InputStream fis = new FileInputStream("readme.txt");
          InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
          BufferedReader br = new BufferedReader(isr);
      ) 
      {
          while ((line = br.readLine()) != null) {
  
              if (yo.equalsIgnoreCase(line)) {
                  System.out.print("Hello");
              }
          }
      } catch (IOException ex) {
          Logger.getLogger(ArfArf.class.getName()).log(Level.SEVERE, null, ex);
      }
  </code></pre>