title: How can I use Scanner on switch case for String of array so that case takes in value from String b
body: <p>How can I use Scanner class in "switch case" to determine the result;</p>
  
  <p>Goal is to be able to use Scanner to determine the case. When user will input value in the scanner the select case will be able to use that String value (e.g if user type Mocking Bird in the Scanner it will be recognized in the switch case and out the code</p>
  
  <pre><code>    import java.util.Scanner;
  
      Scanner input = new Scanner(System.in);
      String b = input.next();
  
      String Books[] = { "Harry Potter", "To Kill a Mocking Bird", "Hunger Games" };
  
      for (int t = 0; t &lt; Books.length; t++) {
  
        switch (Books[t]) {
  
          case "Harry Potter":
           System.out.println("Getting from switch case " + t + " " + Books[t]);
               break;
  
          case "To Kill a Mocking Bird"        
           System.out.println("Getting from switch case " + t + " " + Books[t]);
                break;
  
          default:
              break;
          }
       }
  </code></pre>