lundi 21 décembre 2015

Dead branch in if else statement

I'm writing this code where you give the the program a name.

Java is telling me that the else in the statement is never used when it should be used if the variable "isACoolGuy" is false.

if (isACoolGuy = true){
        System.out.println("Thank you for this name... "+ name);
    }else if(isACoolGuy = false){    
        System.out.println("Okay im changing my name since you are an idiot");
        name = name = "jack";
        System.out.println("My name is "+ name + " now");

There is a switch statement earlier that should change the "isACoolGuy" Boolean to false.

case "name":
            System.out.println("You are an a******");
            isACoolGuy = false;
            break;

Aucun commentaire:

Enregistrer un commentaire