Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   Why doesn't this work? (https://www.askmehelpdesk.com/showthread.php?t=713334)

  • Nov 1, 2012, 04:45 AM
    Infexis
    Why doesn't this work?
    I am very new to java and this is my first little program I'm trying to write, it's really simple. However, I've run into a little problem and I don't know how to fix it, any input would be greatly appreciated.

    Here's the code:

    import java.util.Scanner;

    class apples{
    public static void main(String args[]){
    Scanner input = new Scanner(System.in);
    System.out.println("Write 'sup' in the console, then press enter, please. " + "\n" );
    String sup = input.nextLine();
    if (sup.equals("sup" || "Sup"))
    {
    System.out.println(" dawg." + "\n");
    }
    else{
    System.out.println("\n" + "'" + sup + "'" + "...." + "\n" + "\n" + "Was this was I asked you to write?" + "\n" + "\n" + "Can't follow simple directions, eh?" + "\n");
    }
    }
    }

    The problem is the "if (sup.equals("if (sup.equals(" || " || "))" line.

    I have no idea how to make it accept both of the "))" and "sup" statements. Help plx :)

  • All times are GMT -7. The time now is 02:57 AM.