Greetings,
I'm absolute beginner and I'm training a primitive program that ask you for a cookie and if you write "cookie" it shall thank you and if you write anything else, it'll be sad.
But whatever I write, it still says me it's not a cookie..
I'm a bit lost, cannot find anything on internet.. I'll be very glad for respond
Code:
import java.util.Scanner; class cookie { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Insert cookie: "); String temp = input.nextLine(); if(temp == "cookie"){ System.out.println("Thanks, nomnomnom"); }else{ System.out.println("Not a cookie. :("); } } }