All language subtitles for 040 Wrapper Class_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
ceb Cebuano
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
hmn Hmong
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
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
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 Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
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,210 --> 00:00:02,400 Every primitive type has a wrapper class. 2 00:00:05,390 --> 00:00:09,770 Java is object oriented, that means there is a class for every primitive type. 3 00:00:19,070 --> 00:00:21,470 In this lesson, you'll learn about wrapper classes. 4 00:00:24,160 --> 00:00:28,030 You can find the code for this lesson by following this path in the resources. 5 00:00:38,040 --> 00:00:40,530 Let's get one question out of the way, what is a rapper? 6 00:00:41,070 --> 00:00:44,850 A rapper is an immutable class that wraps around a primitive type. 7 00:00:47,200 --> 00:00:54,730 Here's an example, integer integer is an immutable class that wraps around the type because integer 8 00:00:54,730 --> 00:00:59,530 is an immutable class, then variables of that type story, a reference to an object. 9 00:01:00,790 --> 00:01:07,840 They can be now, they can call methods, but they cannot change, which means they are immune to the 10 00:01:07,840 --> 00:01:08,650 reference trap. 11 00:01:14,880 --> 00:01:19,890 So inside Rupert Java, there are a bunch of primitive variables if you view the runtime. 12 00:01:26,330 --> 00:01:31,820 You'll notice that a primitive is just a value and nothing more, and because it's primitive, the variable 13 00:01:31,820 --> 00:01:34,580 cannot be null and it cannot call any methods. 14 00:01:41,440 --> 00:01:43,840 And so we can set up a variable of type integer. 15 00:01:48,310 --> 00:01:54,070 Equal to a new object of the integer class and then pass the integer value into the constructor. 16 00:02:00,850 --> 00:02:06,370 And now the variable stores a reference to an integer object, the integer object contains a field that 17 00:02:06,370 --> 00:02:07,840 matches the value we pastan. 18 00:02:12,220 --> 00:02:15,850 And because it's an object, the variable can call many methods like. 19 00:02:17,630 --> 00:02:21,660 Percent to string int value, double value and so much more. 20 00:02:25,080 --> 00:02:27,810 And because it's an object, it can also be No. 21 00:02:29,080 --> 00:02:31,740 But there's a shorter way to define a proper object. 22 00:02:32,070 --> 00:02:37,890 The syntax where you directly create a new object of the integer class with the value inside the constructor 23 00:02:37,890 --> 00:02:38,800 is deprecated. 24 00:02:39,210 --> 00:02:44,430 You can just assign the value directly in Java is going to create an object and update the field behind 25 00:02:44,430 --> 00:02:45,120 the scenes. 26 00:02:45,630 --> 00:02:47,580 You can confirm this by running the debugger. 27 00:02:51,600 --> 00:02:57,210 And like before, the variable stores, a reference to an integer object and the integer object contains 28 00:02:57,210 --> 00:02:59,610 a field that matches the value of Pastan. 29 00:03:05,340 --> 00:03:11,820 And here are some more upper classes, double long and character like integer, they are immutable class 30 00:03:11,820 --> 00:03:19,920 types, variables of each type story reference to an object they can be know they can call methods they 31 00:03:19,920 --> 00:03:21,000 cannot change. 32 00:03:21,180 --> 00:03:27,300 You cannot update the status of an immutable object, which means they're immune to the reference trap. 33 00:03:29,770 --> 00:03:35,910 So inside, Rupert Jarvis said the three variables equal to a new object of the respective wrapper class, 34 00:03:36,550 --> 00:03:38,200 first, we're going to do with the Longway. 35 00:04:04,010 --> 00:04:05,330 All the rerun, the debugger. 36 00:04:10,480 --> 00:04:11,650 Step through each line. 37 00:04:13,820 --> 00:04:19,610 And notice that every object contains a field that matches the value that we bastin because they're 38 00:04:19,610 --> 00:04:23,000 all objects, each one can be null and can call methods. 39 00:04:26,940 --> 00:04:32,460 And so in general, the syntax where you create a new object of the wrapper class is deprecated, you 40 00:04:32,460 --> 00:04:37,290 can just assign the value directly and Jeff is going to create an object and update every field behind 41 00:04:37,290 --> 00:04:37,980 the scenes. 42 00:04:46,000 --> 00:04:51,910 Let's talk about the reference trap rappers are immutable class types, so they are immune to the trap. 43 00:04:54,800 --> 00:05:00,080 A rapper such as Integer doesn't have any suitors, so it's impossible to update the field. 44 00:05:01,340 --> 00:05:04,010 Let's set another integer variable equal to the first. 45 00:05:13,350 --> 00:05:19,330 Launched the debugger, and it follows that when you set an integer variable equal to another, it copies 46 00:05:19,330 --> 00:05:24,140 of the reference inside and now both variables are going to point to the same integer object. 47 00:05:24,690 --> 00:05:26,490 Should I worry about the reference trap? 48 00:05:26,790 --> 00:05:32,460 No, it's impossible to update the state of the object when you assign the variable annuity Energia. 49 00:05:40,650 --> 00:05:46,080 When you assign the variable a new integer, it's going to equal a brand new object of the integer class 50 00:05:46,080 --> 00:05:49,950 with the value 10, the same applies to the other rappers. 51 00:05:53,570 --> 00:06:00,110 OK, so you might be asking one to use primitive one to use proper use, primitive 90 percent of the 52 00:06:00,110 --> 00:06:06,560 time, primitive takes up less space and they're faster, only use a wrapper when you need the variable 53 00:06:06,560 --> 00:06:10,340 to be null or when you need to call a method from the variable. 54 00:06:15,610 --> 00:06:17,830 In this lesson, you learned about wrapper classes. 55 00:06:19,290 --> 00:06:25,560 A wrapper class wraps around a primitive type javas object oriented, so there's a class for every primitive 56 00:06:25,560 --> 00:06:25,950 type. 57 00:06:33,190 --> 00:06:39,460 Use a primitive type 90 percent of the time, because they take up less space and they're faster, only 58 00:06:39,460 --> 00:06:44,830 use a wrapper when you absolutely need to, when you need the variable to be known or if you need to 59 00:06:44,830 --> 00:06:46,390 call a method from the variable. 6399

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