Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

New Programmer is Newwww...

Name: Anonymous 2008-04-25 1:16

Before you is a simple script of Java.  For some reason, whenever I put in "pie" I receive the "else" response.  Why?!  I know I'm overlooking something... but I'm just not seeing it

import java.util.Scanner;

class IfElse {
   
        public static void main(String args[])  {
           
            Scanner myScanner = new Scanner(System.in);
            String UserInput;
           
            System.out.println("Pie or Cake?");
            UserInput = myScanner.next();
           
            if (UserInput == "pie")  {
                System.out.println("Shit yeah, pie!!!");
            } else {
                System.out.println("FUCK, I love cake");
            }
        }
    }

Anyone?

Name: Anonymous 2008-04-25 2:12

>>1
/pr/ is that way ――――――――►

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List