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
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

Original subtitles

Every primitive type has a wrapper class.

Java is object oriented, that means there is a class for every primitive type.

In this lesson, you'll learn about wrapper classes.

You can find the code for this lesson by following this path in the resources.

Let's get one question out of the way, what is a rapper?

A rapper is an immutable class that wraps around a primitive type.

Here's an example, integer integer is an immutable class that wraps around the type because integer

is an immutable class, then variables of that type story, a reference to an object.

They can be now, they can call methods, but they cannot change, which means they are immune to the

reference trap.

So inside Rupert Java, there are a bunch of primitive variables if you view the runtime.

You'll notice that a primitive is just a value and nothing more, and because it's primitive, the variable

cannot be null and it cannot call any methods.

And so we can set up a variable of type integer.

Equal to a new object of the integer class and then pass the integer value into the constructor.

And now the variable stores a reference to an integer object, the integer object contains a field that

matches the value we pastan.

And because it's an object, the variable can call many methods like.

Percent to string int value, double value and so much more.

And because it's an object, it can also be No.

But there's a shorter way to define a proper object.

The syntax where you directly create a new object of the integer class with the value inside the constructor

is deprecated.

You can just assign the value directly in Java is going to create an object and update the field behind

the scenes.

You can confirm this by running the debugger.

And like before, the variable stores, a reference to an integer object and the integer object contains

a field that matches the value of Pastan.

And here are some more upper classes, double long and character like integer, they are immutable class

types, variables of each type story reference to an object they can be know they can call methods they

cannot change.

You cannot update the status of an immutable object, which means they're immune to the reference trap.

So inside, Rupert Jarvis said the three variables equal to a new object of the respective wrapper class,

first, we're going to do with the Longway.

All the rerun, the debugger.

Step through each line.

And notice that every object contains a field that matches the value that we bastin because they're

all objects, each one can be null and can call methods.

And so in general, the syntax where you create a new object of the wrapper class is deprecated, you

can just assign the value directly and Jeff is going to create an object and update every field behind

the scenes.

Let's talk about the reference trap rappers are immutable class types, so they are immune to the trap.

A rapper such as Integer doesn't have any suitors, so it's impossible to update the field.

Let's set another integer variable equal to the first.

Launched the debugger, and it follows that when you set an integer variable equal to another, it copies

of the reference inside and now both variables are going to point to the same integer object.

Should I worry about the reference trap?

No, it's impossible to update the state of the object when you assign the variable annuity Energia.

When you assign the variable a new integer, it's going to equal a brand new object of the integer class

with the value 10, the same applies to the other rappers.

OK, so you might be asking one to use primitive one to use proper use, primitive 90 percent of the

time, primitive takes up less space and they're faster, only use a wrapper when you need the variable

to be null or when you need to call a method from the variable.

In this lesson, you learned about wrapper classes.

A wrapper class wraps around a primitive type javas object oriented, so there's a class for every primitive

type.

Use a primitive type 90 percent of the time, because they take up less space and they're faster, only

use a wrapper when you absolutely need to, when you need the variable to be known or if you need to

call a method from the variable.

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