BP Forums
can someone help me out? - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: Java (https://bpforums.info/forumdisplay.php?fid=19)
+---- Thread: can someone help me out? (/showthread.php?tid=781)



can someone help me out? - andrei.xd23 - 05-08-2013

Code:
import java.util.Scanner;


public class test3 {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args)
    {
        String a = "Warrior";
        System.out.println("What are we?\na.Warriors\nb.Mages\nc.Noobs");
        String answer = sc.nextLine();
        if (a == answer)
        {
            System.out.println("That's fucking correct. Let's move on");
        }
        else
        {
            System.out.println("Wrong. That's just wrong");
        }
    }
}
ok so i made this code.. but something doesn't work properly ... i mean when i press run anything i write down it's incorrect..


Re: can someone help me out? - andrei.xd23 - 05-08-2013

please forget my noob stuff <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
i should've used if (answer.equals("Warrior")) instead of answer == "Warrior"


Re: can someone help me out? - brandonio21 - 05-08-2013

Glad you've figured it out! Best of luck to ya!