So now we are back to intelligence.
First, I will show you some examples of automatic conversion.
As I mentioned previously, a number of seats as a bite is enough.
So what happens if the company decides they are going to sell buses to then they will have to use short
instead of bite.
That's right.
Text on the screen just separated from the rest of the code.
So system double quotes conversion.
OK, so we're going to need a short.
That's called a variable new number of seats equals, and the current one is called number of seats
and the SEMICON, that's it.
So let's bring out this number.
The use, copy and paste here.
New value of the number of seats
costs.
New number of seats, so we can add another example here as well, so let's take mileage as an example
so we can store it in an integer, let's double this whole thing and we are going to need and and new
mileage.
And the current number is simply milage.
And the tax is going to change, so new value of mileage is new
mileage.
That's it.
So let's run the code.
Let's see how it works.
All right, so everything looks fine.
Just some formatting issue that's put a space here and that's it.
So we have the same values.
Everything is fine now.
We can store bigger numbers in our variables.
So what happens if we want to do explicit conversion?
Well, it can be problematic.
So let's take power as an example.
We would like to store it in a bite so that C bite.
New power equals.
Power and a semicolon.
OK, as you can see, intelligent underlined the whole line.
So what's the problem here?
So the problem here is that we are missing the cast, the parentheses and the desired data type.
The bite into the J offers us a shortcut.
Just click on the Red Bull and cost to bite it.
And as you can see, it added the parentheses with the byte.
And let's print out the new value.
Sunu value of.
Power.
Plus and new power, let's go up and run it again.
So as you can see, something went terribly wrong here, the new value of power is 106, but it should
show three hundred and sixty two.
Javal started filling up Boit with the value of the power.
We reached the maximum.
Then Java restarted the value to minus 128 and added the rest of the value, which equals to one hundred
and six.
Unfortunately, we lost that here.
So that's why you have to choose your data types very carefully and be cautious when you are narrowing.
So that's all I wanted to say about primitives.
For now.
Let's summarize briefly what we have looked at.
So first I introduced you the primitive data types.
What values can be stored in them.
Then we visited mobile app The Eye and created a list of possible variables and data types.
After that, we did some coding based on that list.
We also looked into the two types of data conversion and we also had some examples for those.
I hope it was clear and useful.
Feel free to ask me any questions.
See you in the next video.