All language subtitles for 036 Primitive vs. Class Type_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

What if I told you that almost everything in Java is an object, I'm going to circle back to the statement

because it's pretty bold.

First, you need to learn the difference between primitive versus class types.

Primitive types are the most basic types of data.

Int double boolean car.

A variable of the primitive type stores, a value directly.

Remember, this primitives represent a value, nothing more like the boolean true, or the number six

primitives cannot be No.

They have no methods.

Class types, also known as reference types, are classes that you can create objects from.

Dealership and car were class types from which we created dealership and car objects.

Remember this, a class type variable points to an object.

It can be no.

And it can call methods from middle class.

Here's a table that summarizes primitive versus class types.

It's in your cheat sheet.

Now, here's a fun fact for you, string is a class type.

First, ask yourself why String capitalized because string is actually a class and class names, as

you know, start with a capital letter Kemel case.

So according to our table string variables, should story reference that points to an object.

And guess what they do?

When you define a string variable, you're actually creating an object of the string class, the variable

stories, a reference that points to a string object.

And it follows that when you said a string variable equal to another, it copies the reference inside

both variables share a reference to the same string object.

Wait a second.

Shouldn't we worry about the reference trap?

Nope.

When you assign the variable and you string, it equals a brand new string object.

In other words, the reference trap doesn't apply, so you don't have to worry.

Back to our table, string variables can be know there are many methods we can call from the string

class.

Try calling them yourself from a random string and see what they do.

Skinner is also a class type that you've seen many times.

So according to our table Skinner variables should story reference that points to an object they do

when you define a scanner variable, you're creating a new object of the scanner class.

The scanner variable can indeed be no.

And there are many methods we can call from the scanner class.

In fact, we've been using them all along, like next int next, double next, long, next and next

line.

These are all methods that are defined in the scanner class, which you can call from your scanner object.

Let's talk about the null value I mentioned earlier that primitive variables cannot be null.

Variables, objects can be no.

No, only applies when memory size is not fixed, primitive types have a fixed memory size and as four

bytes long is eight bytes.

Class types don't have a fixed memory, an object with 20 fields takes up more memory than an object

with one.

Generally speaking.

An array of 50 elements is going to take up more memory than an array with one.

For this reason, primitives cannot be null and class types can be.

By the way, arrays are also objects as well.

When you create a new era, you're creating a new object of the array class that can store elements.

Everything is just happening behind the scenes.

That being said, almost everything in Java is a class variable, an object.

As long as it stores a reference, can be no can call methods, then it's a class variable.

In this lesson, you learn to tell the difference between a primitive type and a class type, a primitive

represent value and nothing more.

It cannot be, no, and it doesn't have methods.

Examples of primitive types are Ent., long car and boolean.

A class variable story, a reference it can be no, and it can call methods, examples of class types

that we created objects from our scanner dealership and car.

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