Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can someone help me out?
#1
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..
#2
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"
#3
Glad you've figured it out! Best of luck to ya!
My Blog | My Setup | My Videos | Have a wonderful day.


Forum Jump:


Users browsing this thread: 1 Guest(s)