It is because string in Java is not possible to compare with "==" operator.
When you are using the "==" operator, you are compare the object reference related to string. So when you get the real compared to "!=", In fact the return will print "chrome"because the object references being different and actually resulting.
When you wish compare string in Java you could use the equals string method. Like here:
if("chrome".equals(browser)){ ... }
You also can use some utils library to compare these strings, like StringUtils of Apache Commons.
if(StringUtils.equals("chrome", browser)) { ... }
The advantage is the treatments that these libs already provide, such as validation of null and empty values, for example.