Locale getISOCountries() Method in Java with Examples

The getISOCountries() Method of Locale class in Java is used get the collection of arrays of all available two-letter country codes officially defined in ISO 3166.

Syntax:

Locale.getISOCountries()

Parameters: This method does not take any parameters.

Return Value: This method returns the array collection of all two-letter country codes.

Below program illustrates the working of getISOCountries() method:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java code to illustrate getISOCountries() method
  
import java.util.*;
  
public class Locale_Demo {
    public static void main(String[] args)
    {
  
        // Creating a new locale
        String[] country_list
            = Locale.getISOCountries();
  
        // Displaying all the countries
        System.out.println("Below is the list of"
                           + " all the countries code "
                           + "officially defined in ISO 3166.");
  
        for (int i = 0; i < country_list.length; i++)
            System.out.println(i + ":" + country_list[i]);
    }
}

chevron_right


Output:

Below is the list of all the countries code
0:AD
1:AE
2:AF
3:AG
4:AI
5:AL
6:AM
7:AN
8:AO
9:AQ
10:AR
11:AS
12:AT
13:AU
14:AW
15:AX
16:AZ
17:BA
18:BB
19:BD
20:BE
21:BF
22:BG
23:BH
24:BI
25:BJ
26:BL
27:BM
28:BN
29:BO
30:BQ
31:BR
32:BS
33:BT
34:BV
35:BW
36:BY
37:BZ
38:CA
39:CC
40:CD
41:CF
42:CG
43:CH
44:CI
45:CK
46:CL
47:CM
48:CN
49:CO
50:CR
51:CU
52:CV
53:CW
54:CX
55:CY
56:CZ
57:DE
58:DJ
59:DK
60:DM
61:DO
62:DZ
63:EC
64:EE
65:EG
66:EH
67:ER
68:ES
69:ET
70:FI
71:FJ
72:FK
73:FM
74:FO
75:FR
76:GA
77:GB
78:GD
79:GE
80:GF
81:GG
82:GH
83:GI
84:GL
85:GM
86:GN
87:GP
88:GQ
89:GR
90:GS
91:GT
92:GU
93:GW
94:GY
95:HK
96:HM
97:HN
98:HR
99:HT
100:HU
101:ID
102:IE
103:IL
104:IM
105:IN
106:IO
107:IQ
108:IR
109:IS
110:IT
111:JE
112:JM
113:JO
114:JP
115:KE
116:KG
117:KH
118:KI
119:KM
120:KN
121:KP
122:KR
123:KW
124:KY
125:KZ
126:LA
127:LB
128:LC
129:LI
130:LK
131:LR
132:LS
133:LT
134:LU
135:LV
136:LY
137:MA
138:MC
139:MD
140:ME
141:MF
142:MG
143:MH
144:MK
145:ML
146:MM
147:MN
148:MO
149:MP
150:MQ
151:MR
152:MS
153:MT
154:MU
155:MV
156:MW
157:MX
158:MY
159:MZ
160:NA
161:NC
162:NE
163:NF
164:NG
165:NI
166:NL
167:NO
168:NP
169:NR
170:NU
171:NZ
172:OM
173:PA
174:PE
175:PF
176:PG
177:PH
178:PK
179:PL
180:PM
181:PN
182:PR
183:PS
184:PT
185:PW
186:PY
187:QA
188:RE
189:RO
190:RS
191:RU
192:RW
193:SA
194:SB
195:SC
196:SD
197:SE
198:SG
199:SH
200:SI
201:SJ
202:SK
203:SL
204:SM
205:SN
206:SO
207:SR
208:SS
209:ST
210:SV
211:SX
212:SY
213:SZ
214:TC
215:TD
216:TF
217:TG
218:TH
219:TJ
220:TK
221:TL
222:TM
223:TN
224:TO
225:TR
226:TT
227:TV
228:TW
229:TZ
230:UA
231:UG
232:UM
233:US
234:UY
235:UZ
236:VA
237:VC
238:VE
239:VG
240:VI
241:VN
242:VU
243:WF
244:WS
245:YE
246:YT
247:ZA
248:ZM
249:ZW


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.