java - If Statement String = Text for displaying different things on country -
maybe stupid question want use if statement in code, won't work.
string country = getresources().getconfiguration().locale.getlanguage(); if (country = nl);
so want use if statement function when country string "nl" don't know how use if statement think.
it's
if (country.equals("nl")) ...
now:
- equality in general tested double
==
. - string equality should tested
equals
.
some more info future use: using ==
test equality checks if references same (i.e. same object in memory), not need (of course, using primitive values works expected). cases when want have custom equality checks on types can override equals
method , place logic there. happens in case of string
class.
Comments
Post a Comment