Hmm a simple code i dont understand whats wrong plz help...

Here's the code:

import java.awt.*;

import java.util.Scanner;

class Halt{

publicstaticvoid main (String[] arg){

Scanner scan =new Scanner (System.in);

System.out.print("Halt! Who goes there? "); System.out.flush();

String s = scan.nextLine();

if (s =="tor"){

System.out.println("You may pass tor!");

}

else{

System.out.println("You are not permitted to go here, " + s +"!");

}

}

}

The problem is that it prints the "you are not premitted" thing even if I input "tor"?

I don't understand whats wrong plz help...

[1270 byte] By [Ogara] at [2007-11-27 9:45:48]
# 1
if (s.equals("tor")) {Never compare Strings with ==
PhHeina at 2007-7-12 23:55:10 > top of Java-index,Java Essentials,New To Java...
# 2
tnx:)
Ogara at 2007-7-12 23:55:10 > top of Java-index,Java Essentials,New To Java...