mercredi 24 novembre 2021

This doesnt work they way im expecting it too [duplicate]

  1. I believe the main is unneeded but my question is I want my code section to check user input equals a specific string name and print something else it prints something else but it doesn't work because the initial code takes all cases of input into the code but I don't know how to get around that.

    static void Dog(){
    String Breedable;
    Scanner fetch = new Scanner(System.in);
    System.out.println("Enter User Name:");
    String user = fetch.nextLine();
    Breedable = "Dog + Cow + Your Fat Ass = " + user;
    if (user == ("Citrine")){        
    System.out.println("Limey!!");
    } else {
    System.out.println(Breedable);
     }fetch.close();}}
    

Aucun commentaire:

Enregistrer un commentaire