compare strings
I am trying to make a textbased game to practise for example loops.
Could someone please show me how to compare Strings. This is what I have so far:
class KeyPad
{
publicstaticvoid main(String[] args)
{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
String s =new String() ;
String n =new String("north") ;
try
{
s = br.readLine();
if(s == n)
{
System.out.println ("so you want to go north!") ;
}
else
{
System.out.println ("Why didn't you type north?") ;
}
}
catch(Exception e)
{
System.out.println("lol");
}
}
}

