So, I'm not sure what is happening here, if I place encode
or decode
in the args[0]
, it should work right, but it doesn't. I have all the imports and I have a utility class that I'm using as well. I don't understand why, when I run the program with these arguments: java Prog4 encode fly message.txt
it won't work right. It'll go straight to the last else statement.
public class Prog4 {
public static void main(String[] args){
if (args.length != 3){
System.out.println("Enter the right amount of arguments!");
System.exit(0);
}
String command=args[0];
String key= args[1];
String fileName = args[2];
File file = new File(args[2]);
String fileExtention="";
if(args[0]=="encode"){
fileExtention=".crypt";
}
else if (args[0]=="decode"){
fileExtention=".decrypt";
}
else{
System.out.println("Enter decode or encode!");
System.exit(0);
}