Display name of all COUNTRIES with their code in java




In this tutorial we will learn how to Display name of all COUNTRIES with their code in java with program.

Towers of Hanoi problem with n disks in java





Program/Example to Display name of all COUNTRIES with their code in java.
import java.util.Locale;
/*
* Write a program to display name of all countries with their code in java.
*/
public class DisplayAllCountriesWithTheirCodeExample {
   public static void main(String[] args) {
          //Locale.getISOCountries() method will return list of all countryCode codes.
          //Country code returned is two letter word defined in ISO 3166 standard.
          String[] countryCodeCodesArray = Locale.getISOCountries();
          System.out.println("------Start displaying name of all countries with their code------");
          int ctr = 1;
          //Iterate over country codes array
          for (String countryCode : countryCodeCodesArray) {
                 //Now, we will get Locale from countryCode
                 Locale countryLocale = new Locale("", countryCode);
                 System.out.println("S.No = "+ (ctr++) +" > Country Code is = "
                      + countryLocale.getCountry()
                      + ",  Country Name is = " + countryLocale.getDisplayCountry());
          }
          System.out.println("------End displaying name of all countries with their code------");
   }
}
/*OUTPUT
------Start displaying name of all countries with their code------
S.No = 1 > Country Code is = AD,  Country Name is = Andorra
S.No = 2 > Country Code is = AE,  Country Name is = United Arab Emirates
S.No = 3 > Country Code is = AF,  Country Name is = Afghanistan
S.No = 4 > Country Code is = AG,  Country Name is = Antigua and Barbuda
S.No = 5 > Country Code is = AI,  Country Name is = Anguilla
S.No = 6 > Country Code is = AL,  Country Name is = Albania
S.No = 7 > Country Code is = AM,  Country Name is = Armenia
S.No = 8 > Country Code is = AN,  Country Name is = Netherlands Antilles
S.No = 9 > Country Code is = AO,  Country Name is = Angola
S.No = 10 > Country Code is = AQ,  Country Name is = Antarctica
S.No = 11 > Country Code is = AR,  Country Name is = Argentina
S.No = 12 > Country Code is = AS,  Country Name is = American Samoa
S.No = 13 > Country Code is = AT,  Country Name is = Austria
S.No = 14 > Country Code is = AU,  Country Name is = Australia
S.No = 15 > Country Code is = AW,  Country Name is = Aruba
S.No = 16 > Country Code is = AX,  Country Name is = Åland Islands
S.No = 17 > Country Code is = AZ,  Country Name is = Azerbaijan
S.No = 18 > Country Code is = BA,  Country Name is = Bosnia and Herzegovina
S.No = 19 > Country Code is = BB,  Country Name is = Barbados
S.No = 20 > Country Code is = BD,  Country Name is = Bangladesh
S.No = 21 > Country Code is = BE,  Country Name is = Belgium
S.No = 22 > Country Code is = BF,  Country Name is = Burkina Faso
S.No = 23 > Country Code is = BG,  Country Name is = Bulgaria
S.No = 24 > Country Code is = BH,  Country Name is = Bahrain
S.No = 25 > Country Code is = BI,  Country Name is = Burundi
S.No = 26 > Country Code is = BJ,  Country Name is = Benin
S.No = 27 > Country Code is = BL,  Country Name is = Saint Barthélemy
S.No = 28 > Country Code is = BM,  Country Name is = Bermuda
S.No = 29 > Country Code is = BN,  Country Name is = Brunei
S.No = 30 > Country Code is = BO,  Country Name is = Bolivia
S.No = 31 > Country Code is = BQ,  Country Name is = Bonaire, Sint Eustatius and Saba
S.No = 32 > Country Code is = BR,  Country Name is = Brazil
S.No = 33 > Country Code is = BS,  Country Name is = Bahamas
S.No = 34 > Country Code is = BT,  Country Name is = Bhutan
S.No = 35 > Country Code is = BV,  Country Name is = Bouvet Island
S.No = 36 > Country Code is = BW,  Country Name is = Botswana
S.No = 37 > Country Code is = BY,  Country Name is = Belarus
S.No = 38 > Country Code is = BZ,  Country Name is = Belize
S.No = 39 > Country Code is = CA,  Country Name is = Canada
S.No = 40 > Country Code is = CC,  Country Name is = Cocos Islands
S.No = 41 > Country Code is = CD,  Country Name is = The Democratic Republic Of Congo
S.No = 42 > Country Code is = CF,  Country Name is = Central African Republic
S.No = 43 > Country Code is = CG,  Country Name is = Congo
S.No = 44 > Country Code is = CH,  Country Name is = Switzerland
S.No = 45 > Country Code is = CI,  Country Name is = Côte d'Ivoire
S.No = 46 > Country Code is = CK,  Country Name is = Cook Islands
S.No = 47 > Country Code is = CL,  Country Name is = Chile
S.No = 48 > Country Code is = CM,  Country Name is = Cameroon
S.No = 49 > Country Code is = CN,  Country Name is = China
S.No = 50 > Country Code is = CO,  Country Name is = Colombia
S.No = 51 > Country Code is = CR,  Country Name is = Costa Rica
S.No = 52 > Country Code is = CU,  Country Name is = Cuba
S.No = 53 > Country Code is = CV,  Country Name is = Cape Verde
S.No = 54 > Country Code is = CW,  Country Name is = Curaçao
S.No = 55 > Country Code is = CX,  Country Name is = Christmas Island
S.No = 56 > Country Code is = CY,  Country Name is = Cyprus
S.No = 57 > Country Code is = CZ,  Country Name is = Czech Republic
S.No = 58 > Country Code is = DE,  Country Name is = Germany
S.No = 59 > Country Code is = DJ,  Country Name is = Djibouti
S.No = 60 > Country Code is = DK,  Country Name is = Denmark
S.No = 61 > Country Code is = DM,  Country Name is = Dominica
S.No = 62 > Country Code is = DO,  Country Name is = Dominican Republic
S.No = 63 > Country Code is = DZ,  Country Name is = Algeria
S.No = 64 > Country Code is = EC,  Country Name is = Ecuador
S.No = 65 > Country Code is = EE,  Country Name is = Estonia
S.No = 66 > Country Code is = EG,  Country Name is = Egypt
S.No = 67 > Country Code is = EH,  Country Name is = Western Sahara
S.No = 68 > Country Code is = ER,  Country Name is = Eritrea
S.No = 69 > Country Code is = ES,  Country Name is = Spain
S.No = 70 > Country Code is = ET,  Country Name is = Ethiopia
S.No = 71 > Country Code is = FI,  Country Name is = Finland
S.No = 72 > Country Code is = FJ,  Country Name is = Fiji
S.No = 73 > Country Code is = FK,  Country Name is = Falkland Islands
S.No = 74 > Country Code is = FM,  Country Name is = Micronesia
S.No = 75 > Country Code is = FO,  Country Name is = Faroe Islands
S.No = 76 > Country Code is = FR,  Country Name is = France
S.No = 77 > Country Code is = GA,  Country Name is = Gabon
S.No = 78 > Country Code is = GB,  Country Name is = United Kingdom
S.No = 79 > Country Code is = GD,  Country Name is = Grenada
S.No = 80 > Country Code is = GE,  Country Name is = Georgia
S.No = 81 > Country Code is = GF,  Country Name is = French Guiana
S.No = 82 > Country Code is = GG,  Country Name is = Guernsey
S.No = 83 > Country Code is = GH,  Country Name is = Ghana
S.No = 84 > Country Code is = GI,  Country Name is = Gibraltar
S.No = 85 > Country Code is = GL,  Country Name is = Greenland
S.No = 86 > Country Code is = GM,  Country Name is = Gambia
S.No = 87 > Country Code is = GN,  Country Name is = Guinea
S.No = 88 > Country Code is = GP,  Country Name is = Guadeloupe
S.No = 89 > Country Code is = GQ,  Country Name is = Equatorial Guinea
S.No = 90 > Country Code is = GR,  Country Name is = Greece
S.No = 91 > Country Code is = GS,  Country Name is = South Georgia And The South Sandwich Islands
S.No = 92 > Country Code is = GT,  Country Name is = Guatemala
S.No = 93 > Country Code is = GU,  Country Name is = Guam
S.No = 94 > Country Code is = GW,  Country Name is = Guinea-Bissau
S.No = 95 > Country Code is = GY,  Country Name is = Guyana
S.No = 96 > Country Code is = HK,  Country Name is = Hong Kong
S.No = 97 > Country Code is = HM,  Country Name is = Heard Island And McDonald Islands
S.No = 98 > Country Code is = HN,  Country Name is = Honduras
S.No = 99 > Country Code is = HR,  Country Name is = Croatia
S.No = 100 > Country Code is = HT,  Country Name is = Haiti
S.No = 101 > Country Code is = HU,  Country Name is = Hungary
S.No = 102 > Country Code is = ID,  Country Name is = Indonesia
S.No = 103 > Country Code is = IE,  Country Name is = Ireland
S.No = 104 > Country Code is = IL,  Country Name is = Israel
S.No = 105 > Country Code is = IM,  Country Name is = Isle Of Man
S.No = 106 > Country Code is = IN,  Country Name is = India
S.No = 107 > Country Code is = IO,  Country Name is = British Indian Ocean Territory
S.No = 108 > Country Code is = IQ,  Country Name is = Iraq
S.No = 109 > Country Code is = IR,  Country Name is = Iran
S.No = 110 > Country Code is = IS,  Country Name is = Iceland
S.No = 111 > Country Code is = IT,  Country Name is = Italy
S.No = 112 > Country Code is = JE,  Country Name is = Jersey
S.No = 113 > Country Code is = JM,  Country Name is = Jamaica
S.No = 114 > Country Code is = JO,  Country Name is = Jordan
S.No = 115 > Country Code is = JP,  Country Name is = Japan
S.No = 116 > Country Code is = KE,  Country Name is = Kenya
S.No = 117 > Country Code is = KG,  Country Name is = Kyrgyzstan
S.No = 118 > Country Code is = KH,  Country Name is = Cambodia
S.No = 119 > Country Code is = KI,  Country Name is = Kiribati
S.No = 120 > Country Code is = KM,  Country Name is = Comoros
S.No = 121 > Country Code is = KN,  Country Name is = Saint Kitts And Nevis
S.No = 122 > Country Code is = KP,  Country Name is = North Korea
S.No = 123 > Country Code is = KR,  Country Name is = South Korea
S.No = 124 > Country Code is = KW,  Country Name is = Kuwait
S.No = 125 > Country Code is = KY,  Country Name is = Cayman Islands
S.No = 126 > Country Code is = KZ,  Country Name is = Kazakhstan
S.No = 127 > Country Code is = LA,  Country Name is = Laos
S.No = 128 > Country Code is = LB,  Country Name is = Lebanon
S.No = 129 > Country Code is = LC,  Country Name is = Saint Lucia
S.No = 130 > Country Code is = LI,  Country Name is = Liechtenstein
S.No = 131 > Country Code is = LK,  Country Name is = Sri Lanka
S.No = 132 > Country Code is = LR,  Country Name is = Liberia
S.No = 133 > Country Code is = LS,  Country Name is = Lesotho
S.No = 134 > Country Code is = LT,  Country Name is = Lithuania
S.No = 135 > Country Code is = LU,  Country Name is = Luxembourg
S.No = 136 > Country Code is = LV,  Country Name is = Latvia
S.No = 137 > Country Code is = LY,  Country Name is = Libya
S.No = 138 > Country Code is = MA,  Country Name is = Morocco
S.No = 139 > Country Code is = MC,  Country Name is = Monaco
S.No = 140 > Country Code is = MD,  Country Name is = Moldova
S.No = 141 > Country Code is = ME,  Country Name is = Montenegro
S.No = 142 > Country Code is = MF,  Country Name is = Saint Martin
S.No = 143 > Country Code is = MG,  Country Name is = Madagascar
S.No = 144 > Country Code is = MH,  Country Name is = Marshall Islands
S.No = 145 > Country Code is = MK,  Country Name is = Macedonia
S.No = 146 > Country Code is = ML,  Country Name is = Mali
S.No = 147 > Country Code is = MM,  Country Name is = Myanmar
S.No = 148 > Country Code is = MN,  Country Name is = Mongolia
S.No = 149 > Country Code is = MO,  Country Name is = Macao
S.No = 150 > Country Code is = MP,  Country Name is = Northern Mariana Islands
S.No = 151 > Country Code is = MQ,  Country Name is = Martinique
S.No = 152 > Country Code is = MR,  Country Name is = Mauritania
S.No = 153 > Country Code is = MS,  Country Name is = Montserrat
S.No = 154 > Country Code is = MT,  Country Name is = Malta
S.No = 155 > Country Code is = MU,  Country Name is = Mauritius
S.No = 156 > Country Code is = MV,  Country Name is = Maldives
S.No = 157 > Country Code is = MW,  Country Name is = Malawi
S.No = 158 > Country Code is = MX,  Country Name is = Mexico
S.No = 159 > Country Code is = MY,  Country Name is = Malaysia
S.No = 160 > Country Code is = MZ,  Country Name is = Mozambique
S.No = 161 > Country Code is = NA,  Country Name is = Namibia
S.No = 162 > Country Code is = NC,  Country Name is = New Caledonia
S.No = 163 > Country Code is = NE,  Country Name is = Niger
S.No = 164 > Country Code is = NF,  Country Name is = Norfolk Island
S.No = 165 > Country Code is = NG,  Country Name is = Nigeria
S.No = 166 > Country Code is = NI,  Country Name is = Nicaragua
S.No = 167 > Country Code is = NL,  Country Name is = Netherlands
S.No = 168 > Country Code is = NO,  Country Name is = Norway
S.No = 169 > Country Code is = NP,  Country Name is = Nepal
S.No = 170 > Country Code is = NR,  Country Name is = Nauru
S.No = 171 > Country Code is = NU,  Country Name is = Niue
S.No = 172 > Country Code is = NZ,  Country Name is = New Zealand
S.No = 173 > Country Code is = OM,  Country Name is = Oman
S.No = 174 > Country Code is = PA,  Country Name is = Panama
S.No = 175 > Country Code is = PE,  Country Name is = Peru
S.No = 176 > Country Code is = PF,  Country Name is = French Polynesia
S.No = 177 > Country Code is = PG,  Country Name is = Papua New Guinea
S.No = 178 > Country Code is = PH,  Country Name is = Philippines
S.No = 179 > Country Code is = PK,  Country Name is = Pakistan
S.No = 180 > Country Code is = PL,  Country Name is = Poland
S.No = 181 > Country Code is = PM,  Country Name is = Saint Pierre And Miquelon
S.No = 182 > Country Code is = PN,  Country Name is = Pitcairn
S.No = 183 > Country Code is = PR,  Country Name is = Puerto Rico
S.No = 184 > Country Code is = PS,  Country Name is = Palestine
S.No = 185 > Country Code is = PT,  Country Name is = Portugal
S.No = 186 > Country Code is = PW,  Country Name is = Palau
S.No = 187 > Country Code is = PY,  Country Name is = Paraguay
S.No = 188 > Country Code is = QA,  Country Name is = Qatar
S.No = 189 > Country Code is = RE,  Country Name is = Reunion
S.No = 190 > Country Code is = RO,  Country Name is = Romania
S.No = 191 > Country Code is = RS,  Country Name is = Serbia
S.No = 192 > Country Code is = RU,  Country Name is = Russia
S.No = 193 > Country Code is = RW,  Country Name is = Rwanda
S.No = 194 > Country Code is = SA,  Country Name is = Saudi Arabia
S.No = 195 > Country Code is = SB,  Country Name is = Solomon Islands
S.No = 196 > Country Code is = SC,  Country Name is = Seychelles
S.No = 197 > Country Code is = SD,  Country Name is = Sudan
S.No = 198 > Country Code is = SE,  Country Name is = Sweden
S.No = 199 > Country Code is = SG,  Country Name is = Singapore
S.No = 200 > Country Code is = SH,  Country Name is = Saint Helena
S.No = 201 > Country Code is = SI,  Country Name is = Slovenia
S.No = 202 > Country Code is = SJ,  Country Name is = Svalbard And Jan Mayen
S.No = 203 > Country Code is = SK,  Country Name is = Slovakia
S.No = 204 > Country Code is = SL,  Country Name is = Sierra Leone
S.No = 205 > Country Code is = SM,  Country Name is = San Marino
S.No = 206 > Country Code is = SN,  Country Name is = Senegal
S.No = 207 > Country Code is = SO,  Country Name is = Somalia
S.No = 208 > Country Code is = SR,  Country Name is = Suriname
S.No = 209 > Country Code is = SS,  Country Name is = South Sudan
S.No = 210 > Country Code is = ST,  Country Name is = Sao Tome And Principe
S.No = 211 > Country Code is = SV,  Country Name is = El Salvador
S.No = 212 > Country Code is = SX,  Country Name is = Sint Maarten (Dutch part)
S.No = 213 > Country Code is = SY,  Country Name is = Syria
S.No = 214 > Country Code is = SZ,  Country Name is = Swaziland
S.No = 215 > Country Code is = TC,  Country Name is = Turks And Caicos Islands
S.No = 216 > Country Code is = TD,  Country Name is = Chad
S.No = 217 > Country Code is = TF,  Country Name is = French Southern Territories
S.No = 218 > Country Code is = TG,  Country Name is = Togo
S.No = 219 > Country Code is = TH,  Country Name is = Thailand
S.No = 220 > Country Code is = TJ,  Country Name is = Tajikistan
S.No = 221 > Country Code is = TK,  Country Name is = Tokelau
S.No = 222 > Country Code is = TL,  Country Name is = Timor-Leste
S.No = 223 > Country Code is = TM,  Country Name is = Turkmenistan
S.No = 224 > Country Code is = TN,  Country Name is = Tunisia
S.No = 225 > Country Code is = TO,  Country Name is = Tonga
S.No = 226 > Country Code is = TR,  Country Name is = Turkey
S.No = 227 > Country Code is = TT,  Country Name is = Trinidad and Tobago
S.No = 228 > Country Code is = TV,  Country Name is = Tuvalu
S.No = 229 > Country Code is = TW,  Country Name is = Taiwan
S.No = 230 > Country Code is = TZ,  Country Name is = Tanzania
S.No = 231 > Country Code is = UA,  Country Name is = Ukraine
S.No = 232 > Country Code is = UG,  Country Name is = Uganda
S.No = 233 > Country Code is = UM,  Country Name is = United States Minor Outlying Islands
S.No = 234 > Country Code is = US,  Country Name is = United States
S.No = 235 > Country Code is = UY,  Country Name is = Uruguay
S.No = 236 > Country Code is = UZ,  Country Name is = Uzbekistan
S.No = 237 > Country Code is = VA,  Country Name is = Vatican
S.No = 238 > Country Code is = VC,  Country Name is = Saint Vincent And The Grenadines
S.No = 239 > Country Code is = VE,  Country Name is = Venezuela
S.No = 240 > Country Code is = VG,  Country Name is = British Virgin Islands
S.No = 241 > Country Code is = VI,  Country Name is = U.S. Virgin Islands
S.No = 242 > Country Code is = VN,  Country Name is = Vietnam
S.No = 243 > Country Code is = VU,  Country Name is = Vanuatu
S.No = 244 > Country Code is = WF,  Country Name is = Wallis And Futuna
S.No = 245 > Country Code is = WS,  Country Name is = Samoa
S.No = 246 > Country Code is = YE,  Country Name is = Yemen
S.No = 247 > Country Code is = YT,  Country Name is = Mayotte
S.No = 248 > Country Code is = ZA,  Country Name is = South Africa
S.No = 249 > Country Code is = ZM,  Country Name is = Zambia
S.No = 250 > Country Code is = ZW,  Country Name is = Zimbabwe
------End displaying name of all countries with their code------
*/



Summary -
So in this tutorial we learned how to Display name of all COUNTRIES with their code in java with program.




Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


RELATED LINKS>

How to Concatenate two arrays in java


No comments:

Post a Comment