title: how to i input a sentence so that the program will recognize the sentence as a single word?
body: <p>lets say i input : 'dog is mammal'</p>
  
  <p>i would like to search for this sentence in a text document. How do i do this in java ?</p>
  
  <pre><code>    System.out.println("Please enter the query  :");
      Scanner scan2 = new Scanner(System.in);
      String word2 = scan2.nextLine();
      String[] array2 = word2.split(" ");
  </code></pre>
  
  <p>this code snippet accepts the string 'dog is mammal' and process each tokens separately.</p>
  
  <p>For example : 'dog is mammal'</p>
  
  <p>dog</p>
  
  <p>></p>
  
  <p>></p>
  
  <p>is</p>
  
  <p>></p>
  
  <p>></p>
  
  <p>mammal</p>
  
  <p>></p>
  
  <p>></p>
  
  <p>i would like to process the input as </p>
  
  <p>dog is mammal</p>
  
  <p>></p>
  
  <p>></p>
  
  <p>I doesnt want it to process it separately. I wanted it to process it as a single string and look for matches. Can anyone let me know where i am lacking ? </p>