title: "The method toCharArray() is undefined for the type Scanner"
body: <p>I am trying to reverse a <code>String</code> inputted by the user, but I am receiving this error when I run the program:</p>
  
  <pre><code> Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
     The method toCharArray() is undefined for the type Scanner
  </code></pre>
  
  <p>Why am I getting this error? Here's my program:</p>
  
  <pre><code>import java.util.Scanner;
  
  public abstract class StringReverse {
      public abstract char[] toCharArray();
      private static Scanner input;
  
      public static &lt;string&gt; void main(String[] args){
          System.out.println("Enter a string: ");
          Scanner String = new Scanner(System.in);
          String str = input.next();
          char[] strArray = input.toCharArray();
  
          for (int i = strArray.length - 1; i &gt;= 0; i--)
          {
              System.out.print(strArray[i]);
          }
      }
  }
  </code></pre>