I think Method A will displays "Ok", but in fact it displays "Fails". The Method B can get the correct result "OK".
I'm sure that the function fi.iki.elonen.NanoHTTPD.getMimeTypeForFile("my.css")
will return the result "text/css".
I don't understand why the Method A can't get correct result. Is there some bugs with the function fi.iki.elonen.NanoHTTPD.getMimeTypeForFile
?
BTW, Method C can get the correct result "OK".
Method A
String a="text/css";
String b= fi.iki.elonen.NanoHTTPD.getMimeTypeForFile("my.css");
Utility.LogError("B: "+b);
if (a==b){
Utility.LogError("Ok");
}else{
Utility.LogError("Fails");
}
Method B
String a="text/css";
String b= fi.iki.elonen.NanoHTTPD.getMimeTypeForFile("my.css");
Utility.LogError("B: "+b);
if (a.compareTo(b)==0){
Utility.LogError("Ok");
}else{
Utility.LogError("Fails");
}
Method C
String a="text/css";
String b= "text/css";
Utility.LogError("B: "+b);
if (a==b){
Utility.LogError("Ok");
}else{
Utility.LogError("Fails");
}