Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
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.