Hi...

i am trying to run this program...and it stays that it does not have a main method...

public static void...

but i have the public static final int...
please let me know how i can get this program to run..thanks

public class CaesarCipher {
    
public static final int ALPHASIZE = 26;

public static final char [] alpha = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
protected char[] encrypt = new char[ALPHASIZE];
protected char[] decrypt = new char[ALPHASIZE];
public CaesarCipher() {
    for (int i=0; i<ALPHASIZE; i++)
        encrypt[i] = alpha[(i + 3) % ALPHASIZE];
    for (int i=0; i<ALPHASIZE; i++)
        decrypt[encrypt[i] - 'A'] = alpha[i];
    }
    /** Encryption Method */

 public String encrypt(String secret) {
 char[] mess = secret.toCharArray();
 for (int i=0; i<mess.length; i++)
     if (Character.isUpperCase(mess[i]))
         mess[i] = encrypt[mess[i] - 'A'];
 return new String(mess);
    }
    /** Decryption Method */
 public String decrypt(String secret) {
     char[] mess = secret.toCharArray();
     for (int i=0; i<mess.length; i++)
         if (Character.isUpperCase(mess[i]))
             mess[i] = decrypt[mess[i] - 'A'];
     return new String(mess);
 }
}

i also need to write the program for the lower case letters...i will need to do the same thing right?? like using the same method..

add the following method:

public static void main(String[] args) {
		CaesarCipher cc = new CaesarCipher();
		
	}
This article has been dead for over six months. Start a new discussion instead.