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
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,580 --> 00:00:06,550 What if I told you that almost everything in Java is an object, I'm going to circle back to the statement 2 00:00:06,550 --> 00:00:07,720 because it's pretty bold. 3 00:00:10,300 --> 00:00:14,550 First, you need to learn the difference between primitive versus class types. 4 00:00:21,200 --> 00:00:23,810 Primitive types are the most basic types of data. 5 00:00:26,090 --> 00:00:28,730 Int double boolean car. 6 00:00:32,460 --> 00:00:35,790 A variable of the primitive type stores, a value directly. 7 00:00:39,020 --> 00:00:45,620 Remember, this primitives represent a value, nothing more like the boolean true, or the number six 8 00:00:46,310 --> 00:00:47,870 primitives cannot be No. 9 00:00:50,180 --> 00:00:51,620 They have no methods. 10 00:00:57,360 --> 00:01:02,460 Class types, also known as reference types, are classes that you can create objects from. 11 00:01:05,180 --> 00:01:11,420 Dealership and car were class types from which we created dealership and car objects. 12 00:01:15,020 --> 00:01:18,620 Remember this, a class type variable points to an object. 13 00:01:20,100 --> 00:01:21,240 It can be no. 14 00:01:22,930 --> 00:01:25,210 And it can call methods from middle class. 15 00:01:28,040 --> 00:01:31,220 Here's a table that summarizes primitive versus class types. 16 00:01:31,310 --> 00:01:32,600 It's in your cheat sheet. 17 00:01:36,520 --> 00:01:39,730 Now, here's a fun fact for you, string is a class type. 18 00:01:42,110 --> 00:01:49,220 First, ask yourself why String capitalized because string is actually a class and class names, as 19 00:01:49,220 --> 00:01:51,860 you know, start with a capital letter Kemel case. 20 00:01:52,860 --> 00:01:57,630 So according to our table string variables, should story reference that points to an object. 21 00:01:57,960 --> 00:01:59,390 And guess what they do? 22 00:02:01,880 --> 00:02:07,940 When you define a string variable, you're actually creating an object of the string class, the variable 23 00:02:07,940 --> 00:02:10,490 stories, a reference that points to a string object. 24 00:02:13,360 --> 00:02:18,430 And it follows that when you said a string variable equal to another, it copies the reference inside 25 00:02:18,430 --> 00:02:22,150 both variables share a reference to the same string object. 26 00:02:23,260 --> 00:02:24,120 Wait a second. 27 00:02:24,160 --> 00:02:26,110 Shouldn't we worry about the reference trap? 28 00:02:27,380 --> 00:02:27,910 Nope. 29 00:02:29,480 --> 00:02:34,130 When you assign the variable and you string, it equals a brand new string object. 30 00:02:35,430 --> 00:02:39,480 In other words, the reference trap doesn't apply, so you don't have to worry. 31 00:02:48,950 --> 00:02:54,890 Back to our table, string variables can be know there are many methods we can call from the string 32 00:02:54,890 --> 00:02:55,340 class. 33 00:02:59,550 --> 00:03:02,700 Try calling them yourself from a random string and see what they do. 34 00:03:07,310 --> 00:03:10,760 Skinner is also a class type that you've seen many times. 35 00:03:14,370 --> 00:03:20,400 So according to our table Skinner variables should story reference that points to an object they do 36 00:03:21,120 --> 00:03:25,740 when you define a scanner variable, you're creating a new object of the scanner class. 37 00:03:29,170 --> 00:03:31,210 The scanner variable can indeed be no. 38 00:03:32,830 --> 00:03:35,650 And there are many methods we can call from the scanner class. 39 00:03:36,040 --> 00:03:40,960 In fact, we've been using them all along, like next int next, double next, long, next and next 40 00:03:40,960 --> 00:03:41,440 line. 41 00:03:42,490 --> 00:03:47,950 These are all methods that are defined in the scanner class, which you can call from your scanner object. 42 00:03:52,980 --> 00:03:58,170 Let's talk about the null value I mentioned earlier that primitive variables cannot be null. 43 00:04:01,240 --> 00:04:03,460 Variables, objects can be no. 44 00:04:05,750 --> 00:04:13,310 No, only applies when memory size is not fixed, primitive types have a fixed memory size and as four 45 00:04:13,310 --> 00:04:15,440 bytes long is eight bytes. 46 00:04:24,020 --> 00:04:30,140 Class types don't have a fixed memory, an object with 20 fields takes up more memory than an object 47 00:04:30,140 --> 00:04:30,620 with one. 48 00:04:30,680 --> 00:04:31,790 Generally speaking. 49 00:04:33,230 --> 00:04:37,340 An array of 50 elements is going to take up more memory than an array with one. 50 00:04:37,640 --> 00:04:42,020 For this reason, primitives cannot be null and class types can be. 51 00:04:42,620 --> 00:04:45,230 By the way, arrays are also objects as well. 52 00:04:45,930 --> 00:04:51,710 When you create a new era, you're creating a new object of the array class that can store elements. 53 00:04:51,920 --> 00:04:54,020 Everything is just happening behind the scenes. 54 00:04:54,950 --> 00:04:59,600 That being said, almost everything in Java is a class variable, an object. 55 00:05:00,610 --> 00:05:06,670 As long as it stores a reference, can be no can call methods, then it's a class variable. 56 00:05:11,020 --> 00:05:16,210 In this lesson, you learn to tell the difference between a primitive type and a class type, a primitive 57 00:05:16,210 --> 00:05:17,780 represent value and nothing more. 58 00:05:18,070 --> 00:05:20,620 It cannot be, no, and it doesn't have methods. 59 00:05:21,100 --> 00:05:25,060 Examples of primitive types are Ent., long car and boolean. 60 00:05:29,380 --> 00:05:36,040 A class variable story, a reference it can be no, and it can call methods, examples of class types 61 00:05:36,040 --> 00:05:39,430 that we created objects from our scanner dealership and car. 6061

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