i am trying to check a string to see if it is equal to "w" but it wont work.

public File(String FileName, String mode){
System.out.println(mode);
if(mode == "w"){
System.out.println(mode);
OpenWrite(FileName) ;
}
else{
System.out.println("not w");
OpenRead(FileName) ;
}
}

now i know by testing that "w" prints before the equilty statement, but then "not w" prints next, any help would be great.