All language subtitles for 039 Mutable and Immutable Objects_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

Objects can be immutable or immutable.

In the past, we separated primitive types from class types.

We can also separate class types into two categories, immutable and immutable.

In this lesson, you're to learn to tell the difference between mutable and immutable objects.

To access this lesson, follow this path and your resources and open up the mutable folder.

Now, another name for Setar is Mutator before we continue to take some time to absorb this sentence.

Immutable object is an object whose field values can change.

Immutable object uses Mutator is Setas to update its fields.

And so inside Maine, the first line creates an object of the car class.

Let me ask you this, is car a mutable or an immutable class type?

Take a couple of seconds to think about it.

The answer is mutable after you create a car object, it's possible to update it.

In other words, the mutable object can use its mutator as its setas to update its fields.

And so to keep things simple at its core, what makes an object immutable after creating the object,

Wicken updated state, that's it.

We can mutate it.

Now, what is an immovable object, an immutable object is an object whose field values cannot change,

an immutable object does not have Mutator doesn't have Setas.

And you can access this part of the lesson by following this path and the resources and open up the

immutable folder.

Can I go inside, Main Espersen, immutable or an immutable class type?

Think about it.

The answer is immutable after you create a personal object, it's impossible to update it.

All of the fields are private and the person class doesn't have any setas.

This makes every object of the person class immutable.

It's impossible to update the state of a person object after you create it.

This leads us to the reference chart, mutable objects are vulnerable to the reference trap.

Immutable objects are immune to the reference trap.

So these two tables don't make any sense.

The reference job doesn't apply to immutable objects, so the tables need to specify that mutable objects

are the ones that are prone to the reference trap.

Let's do just that.

OK, this feels better.

You now inside main job, we're going to set another variable equal to the first object.

And then I'm going to update the object from the second variable.

Then I'll print the gold from both objects.

Run the code.

And unsurprisingly, updating the state of the second variable affects the first one.

When you set a variable equal to another, it copies the value inside in this case, what's inside is

a reference, and now both variables share a reference that points to the same object.

If I update the object there, one variable, it's going to affect the other.

And so mutable objects are vulnerable to the reference trap.

What about immutable objects?

Inside Main Java set another variable equal to the first person object.

OK, what now?

Every object of the person class is immutable, the fields are private and the person class doesn't

have any setas.

So even if both variables share a reference to the same object, there's nothing you can do to update

the state of either one.

Let me just put breakpoints.

You can visualize the runtime.

And so here, both variables share a reference to the same object, but that doesn't matter because

we can't update either one.

All you can do is set the second variable equal to a brand new object.

But in that case, the second variable story is a new reference that points to a unique object.

And so I hope you can see that immutable objects are immune to the reference trap.

OK, so first we need to update this table, because we can also divide class types into two categories,

mutable and immutable.

Mutable objects can update their status, immutable objects cannot mutable objects are vulnerable to

the reference Tropp immutable objects are immune.

Array is a mutable object, there is a class for every array type.

There's a class for array of integers, array of double array of long, etc..

So looking at this example, the variable equals the new object of the entire class.

The variable stores a reference to an object, the variable can be no, it can call methods, you can

update the state of an array, and arrays are vulnerable to the reference trap.

And since arrays are mutable objects, we don't need these two tables, the Redundance.

Remove them.

And this looks a lot better.

Let's recap, you learn to tell the difference between mutable and immutable objects.

You can update the state of immutable object, but you can't update the state of an immutable object.

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