vendredi 4 décembre 2015

Java if-statement not working as expected

public class TwoMonkeysSmile {

  public static void main(String[] args) {
    String A = "the First Monkey";
    String B = "the Second Monkey";
    boolean areSmilling = false;
    if (areSmilling = true) {
      System.out.println("We are busted because: " + A + B + " are smiling");
    else {
      System.out.println("We are not busted because" + A + B + "aren't smilling together");
    }

  }
}

I tried to present the two monkeys and then make it as if we are busted if they are laughing.

Aucun commentaire:

Enregistrer un commentaire