All language subtitles for 014 Enum_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,930 --> 00:00:03,870 An item contains a limited number of constants. 2 00:00:05,260 --> 00:00:09,790 Using enum to ensure something can only be a limited number of values. 3 00:00:12,070 --> 00:00:13,720 In this lesson, you're going to create an enum. 4 00:00:15,900 --> 00:00:19,590 An enum defines a collection of static final constants. 5 00:00:22,250 --> 00:00:26,900 Using Inam to ensure a variable can only be a limited number of values. 6 00:00:30,180 --> 00:00:34,970 The size of a shirt should be limited to three values, small, medium or large. 7 00:00:35,400 --> 00:00:37,590 But what if the caller writes something like Wambo? 8 00:00:38,040 --> 00:00:41,430 They surely can assizes of type string so it can be anything. 9 00:00:42,060 --> 00:00:43,550 Then you might think that's OK. 10 00:00:43,560 --> 00:00:47,040 We could just apply exception handling if the caller writes anything bad. 11 00:00:49,150 --> 00:00:50,980 Yeah, but why do any of that? 12 00:00:51,060 --> 00:00:57,150 From the start, we just use an item to insure this variable can only be a limited number of values. 13 00:00:57,400 --> 00:01:03,070 So inside the shirt class, we're going to create a public item called size that defines three static 14 00:01:03,070 --> 00:01:06,250 final constants, small, medium, large. 15 00:01:10,950 --> 00:01:12,580 This is how you create an item. 16 00:01:12,900 --> 00:01:18,780 All you have to do is make sure to always capitalize constants inside of an item now by default, every 17 00:01:18,780 --> 00:01:20,650 value inside of an enormous final. 18 00:01:21,060 --> 00:01:22,800 These values can never be changed. 19 00:01:23,010 --> 00:01:26,010 Basically, an item is just a collection of final values. 20 00:01:26,940 --> 00:01:31,530 OK, now the problem with the size is that it's a strength, which means it can be any type of value, 21 00:01:31,930 --> 00:01:35,040 we're going to make it an enum type so that it's limited to only three. 22 00:01:36,190 --> 00:01:39,550 And now the constructor needs to receive an item constant. 23 00:01:45,160 --> 00:01:47,770 And now you're going to have to regenerate the getters and setters. 24 00:01:57,980 --> 00:02:04,370 Now, back in Maine, an enum is implicitly static, that means we can access it directly from the class. 25 00:02:06,860 --> 00:02:12,230 And now I can only give the shirt one of three values, small, medium or large, I'm going to give 26 00:02:12,230 --> 00:02:13,280 it a size of small. 27 00:02:17,240 --> 00:02:18,740 And now I can print the object. 28 00:02:31,400 --> 00:02:32,870 And everything works beautifully. 29 00:02:36,520 --> 00:02:39,790 You limited the size field to three possible values. 30 00:02:41,700 --> 00:02:46,290 Use an enum to ensure something can only be a limited number of values. 2967

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.