Java string comparison issues

29 Views Asked by At

I have an issue with a java application I am writing. It takes 3 args in and checks if the first arg is equal to "encrypt" or "decrypt". However when I pass "decrypt" to it, it does not see "decrypt" == "decrypt".

        String type = args[0];
    if(!(type == "encrypt" || type == "decrypt")){
        System.out.println("The first parameter must be \"encrypt\" or \"decrypt\"!");
        System.out.println(usage);
        return;
    }

enter image description here

0

There are 0 best solutions below