Page 1 of 1
About Question enthuware.ocpjp.v8.2.1161 :
Posted: Tue Mar 13, 2018 12:36 pm
by mountiansandals
While technically bad form I thought a country code can be lowercase. This example is cited as being bad but legal in the Boyarsky and Selikoff book:
Locale l2 = new Locale.Builder()
.setRegion("us")
.setLanguage("EN")
.build();
Re: About Question enthuware.ocpjp.v8.2.1161 :
Posted: Wed Mar 14, 2018 3:37 am
by admin
Yes, the book is partially correct. It is correct because lower case values are indeed valid. It is partially correct because Locale class description does not say anywhere that lower case values are bad form. Both are equally acceptable while creating Locale objects.
However, the issue is that some candidates have claimed to get a similar question that asks them to pick correct values for country codes. It seems that the question is asking about the value as returned by
Locale's getCountry method, which indeed returns only upper case values.
Paul.