Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

(new Locale("us")).getDisplayCountry() returning empty String

807588Dec 31 2008 — edited Feb 25 2009
Hi,

I am attempting to resolve an ISO 3166 country code (like 'us') to a country name (like 'United States') using the following code
import java.util.Locale;
public class CountryNames {
        public static void main(String args[]) {
                Locale locale = new Locale("us");
                System.out.println("getDisplayCountry is>" + locale.getDisplayCountry() + "<");
        }
}
Following is the output I get
getDisplayCountry is><
But I was expecting to see "United States". Is this the right approach to resolving country codes to country names? Please help.

TIA,
Babu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2009
Added on Dec 31 2008
3 comments
394 views