Ask Experts Questions for FREE Help !
Ask
    Infexis's Avatar
    Infexis Posts: 1, Reputation: 1
    New Member
     
    #1

    Nov 1, 2012, 04:45 AM
    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 :)

Check out some similar questions!

AC doesn't work.Please Help! [ 3 Answers ]

Hello, I have a problem with my AC. So I have a FHP MANUFACTURING DIVISION EM036-1VTC. It's been 1 montH I only had problems with that AC. So I live in a Condo, and the AC is about 10 years old, and we change the motor almost a year ago.

Charging car battery doesn't work. Will jump up work? [ 10 Answers ]

A car battery is dead. I tried to charge the battery by a battery charger but it does not work. The panel lighting still gets dimmer. If the battery is unable to be charged, should I continue to try the jump up or the jump up will also not work? Does jump up functions the same as charging battery...

Why does the sprayer work and the faucet doesn't work? [ 2 Answers ]

The water stopped coming out of the faucet but the hand sprayer still works... I replaced the cartridge but that didn't help. My faucet is an old Moen single lever with a spray attachment.

Ceiling fan doesn't shut off pull chain doesn'work [ 1 Answers ]

Pull chain does not work fan cannot be shut off.pull chain is the only way to turn fan on or off


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.