Home »
Java programming language
Java Locale getISOLanguages() Method with Example
Locale Class getISOLanguages() method: Here, we are going to learn about the getISOLanguages() method of Locale Class with its syntax and example.
Submitted by Preeti Jain, on March 08, 2020
Locale Class getISOLanguages() method
- getISOLanguages() method is available in java.util package.
- getISOLanguages() method is used to return an array of string that holds two-letter available language codes in ISO 639.
- getISOLanguages() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get an error.
- getISOLanguages() method does not throw an exception at the time of returning the array of the string of language codes.
Syntax:
public static String[] getISOLanguages();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of the method is String[], it returns list of all two letter language codes that exists in ISO 639.
Example:
// Java program to demonstrate the example
// of String[] getISOLanguages() method of Locale
import java.util.*;
public class GetISOLanguagesOfLocale {
public static void main(String[] args) {
// Instantiates Locale
Locale lo = new Locale("JAPANESE", "JAPAN");
// Display Locale
System.out.println("lo: " + lo);
// By using getISOLanguages() method is
// to return all 2 letter ISO 3166 codes
// for the locale languages
String[] lang = lo.getISOLanguages();
System.out.println("lo.getISOLanguages(): ");
for (int i = 0; i < lang.length; ++i)
System.out.println(lang[i]);
}
}
Output
lo: japanese_JAPAN
lo.getISOLanguages():
aa
ab
ae
af
ak
am
an
ar
as
av
ay
az
ba
be
bg
bh
bi
bm
bn
bo
br
bs
ca
ce
ch
co
cr
cs
cu
cv
cy
da
de
dv
dz
ee
el
en
eo
es
et
eu
fa
ff
fi
fj
fo
fr
fy
ga
gd
gl
gn
gu
gv
ha
he
hi
ho
hr
ht
hu
hy
hz
ia
id
ie
ig
ii
ik
in
io
is
it
iu
iw
ja
ji
jv
ka
kg
ki
kj
kk
kl
km
kn
ko
kr
ks
ku
kv
kw
ky
la
lb
lg
li
ln
lo
lt
lu
lv
mg
mh
mi
mk
ml
mn
mo
mr
ms
mt
my
na
nb
nd
ne
ng
nl
nn
no
nr
nv
ny
oc
oj
om
or
os
pa
pi
pl
ps
pt
qu
rm
rn
ro
ru
rw
sa
sc
sd
se
sg
si
sk
sl
sm
sn
so
sq
sr
ss
st
su
sv
sw
ta
te
tg
th
ti
tk
tl
tn
to
tr
ts
tt
tw
ty
ug
uk
ur
uz
ve
vi
vo
wa
wo
xh
yi
yo
za
zh
zu