1
00:00:00,670 --> 00:00:02,320
So now we are back to intelligence.

2
00:00:02,830 --> 00:00:07,510
First, I will show you some examples of automatic conversion.

3
00:00:07,960 --> 00:00:12,310
As I mentioned previously, a number of seats as a bite is enough.

4
00:00:12,550 --> 00:00:20,350
So what happens if the company decides they are going to sell buses to then they will have to use short

5
00:00:20,350 --> 00:00:21,400
instead of bite.

6
00:00:21,700 --> 00:00:22,260
That's right.

7
00:00:22,300 --> 00:00:26,020
Text on the screen just separated from the rest of the code.

8
00:00:26,320 --> 00:00:33,400
So system double quotes conversion.

9
00:00:36,910 --> 00:00:39,760
OK, so we're going to need a short.

10
00:00:42,840 --> 00:00:56,220
That's called a variable new number of seats equals, and the current one is called number of seats

11
00:00:57,570 --> 00:01:00,070
and the SEMICON, that's it.

12
00:01:00,810 --> 00:01:03,660
So let's bring out this number.

13
00:01:04,820 --> 00:01:07,760
The use, copy and paste here.

14
00:01:10,500 --> 00:01:18,980
New value of the number of seats

15
00:01:21,410 --> 00:01:22,070
costs.

16
00:01:24,220 --> 00:01:31,520
New number of seats, so we can add another example here as well, so let's take mileage as an example

17
00:01:31,760 --> 00:01:42,590
so we can store it in an integer, let's double this whole thing and we are going to need and and new

18
00:01:45,320 --> 00:01:46,190
mileage.

19
00:01:49,080 --> 00:01:52,890
And the current number is simply milage.

20
00:01:54,580 --> 00:02:04,030
And the tax is going to change, so new value of mileage is new

21
00:02:06,730 --> 00:02:07,690
mileage.

22
00:02:09,210 --> 00:02:09,760
That's it.

23
00:02:09,780 --> 00:02:11,250
So let's run the code.

24
00:02:11,970 --> 00:02:13,280
Let's see how it works.

25
00:02:19,130 --> 00:02:21,320
All right, so everything looks fine.

26
00:02:23,000 --> 00:02:28,140
Just some formatting issue that's put a space here and that's it.

27
00:02:28,400 --> 00:02:30,170
So we have the same values.

28
00:02:30,470 --> 00:02:31,970
Everything is fine now.

29
00:02:31,970 --> 00:02:36,560
We can store bigger numbers in our variables.

30
00:02:36,710 --> 00:02:40,560
So what happens if we want to do explicit conversion?

31
00:02:40,580 --> 00:02:42,830
Well, it can be problematic.

32
00:02:42,840 --> 00:02:45,100
So let's take power as an example.

33
00:02:45,620 --> 00:02:51,770
We would like to store it in a bite so that C bite.

34
00:02:53,990 --> 00:02:57,860
New power equals.

35
00:02:59,150 --> 00:03:01,560
Power and a semicolon.

36
00:03:01,730 --> 00:03:05,210
OK, as you can see, intelligent underlined the whole line.

37
00:03:05,450 --> 00:03:06,740
So what's the problem here?

38
00:03:07,160 --> 00:03:13,760
So the problem here is that we are missing the cast, the parentheses and the desired data type.

39
00:03:14,030 --> 00:03:17,920
The bite into the J offers us a shortcut.

40
00:03:17,930 --> 00:03:21,310
Just click on the Red Bull and cost to bite it.

41
00:03:22,040 --> 00:03:26,150
And as you can see, it added the parentheses with the byte.

42
00:03:26,300 --> 00:03:28,910
And let's print out the new value.

43
00:03:31,660 --> 00:03:33,400
Sunu value of.

44
00:03:34,640 --> 00:03:35,270
Power.

45
00:03:36,850 --> 00:03:42,970
Plus and new power, let's go up and run it again.

46
00:03:47,430 --> 00:03:55,020
So as you can see, something went terribly wrong here, the new value of power is 106, but it should

47
00:03:55,020 --> 00:03:57,930
show three hundred and sixty two.

48
00:03:58,010 --> 00:04:01,870
Javal started filling up Boit with the value of the power.

49
00:04:02,340 --> 00:04:03,810
We reached the maximum.

50
00:04:04,020 --> 00:04:15,480
Then Java restarted the value to minus 128 and added the rest of the value, which equals to one hundred

51
00:04:15,480 --> 00:04:16,500
and six.

52
00:04:17,010 --> 00:04:19,340
Unfortunately, we lost that here.

53
00:04:19,380 --> 00:04:27,300
So that's why you have to choose your data types very carefully and be cautious when you are narrowing.

54
00:04:27,450 --> 00:04:30,330
So that's all I wanted to say about primitives.

55
00:04:30,330 --> 00:04:30,900
For now.

56
00:04:31,410 --> 00:04:33,740
Let's summarize briefly what we have looked at.

57
00:04:34,200 --> 00:04:37,740
So first I introduced you the primitive data types.

58
00:04:38,190 --> 00:04:40,350
What values can be stored in them.

59
00:04:40,530 --> 00:04:47,580
Then we visited mobile app The Eye and created a list of possible variables and data types.

60
00:04:47,910 --> 00:04:51,950
After that, we did some coding based on that list.

61
00:04:51,990 --> 00:05:00,240
We also looked into the two types of data conversion and we also had some examples for those.

62
00:05:00,480 --> 00:05:02,730
I hope it was clear and useful.

63
00:05:03,060 --> 00:05:05,320
Feel free to ask me any questions.

64
00:05:05,700 --> 00:05:07,080
See you in the next video.
