title: Alphabet Encryption
body: <p>Right now I cant even compile this program. Im trying to write a program that takes a inputted string and then encrypts the letters by swapping them out with another letter predetermined in a array and then shows you again the original text. any help would be appreciated. </p>
  
  <pre><code>import java.util.Scanner;
  public class Array {
      private char [] alphabet = new char [25];
      private char [] crypt = new char [25];
      String oldMessage;
  
  
      public Array()
      {    char[] alphabet = "abcdefghijklmnoptqrstuvwxyz".toCharArray(); 
       char[] crypt = "qwertyuiopasdfghjklzxcvbnm|".toCharArray();
  
      }        
  
      public static void run(){ 
  
          Scanner scan = new Scanner(System.in);
          System.out.println("Enter a message that you would like to encrypt\n");
          oldMessage = scan.nextLine();
  
          String newMessage = "";
          for (int i=0; i&lt;oldMessage.length(); ++i) {
              int index = alphabet.indexOf(old.charAt(i));
              if (index == -1)
                  newMessage +="?";
              else 
                  newMessage += crypt.charAt(index);
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {Array myApplication = new Array(); myApplication.run();}
  </code></pre>