Hello. I'm attempting to start a Caesar cipher program and can't get the program to display the output key[1]. Here is my code:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Caesar {
private String[] key = new String[26];
public static void main(String[] args){
Scanner kbd = new Scanner(System.in);
String task = kbd.next();
int N = kbd.nextInt();
String file = kbd.next();
if (!task.equalsIgnoreCase("-d") && !task.equalsIgnoreCase("-e") ){
System.out.println("usage: -d|-e");
System.exit(0);
}
}
public void Decrypt(File file){
Scanner kscan = null;
try {
kscan = new Scanner(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
kscan.useDelimiter("\\s");
for(int i=0; i < key.length; i++){
key[i] = kscan.next();
}
System.out.print(key[1]);
}
}
Any help is much appreciated.