1
00:00:04,440 --> 00:00:08,030
So first for example I want to create somebody.

2
00:00:08,070 --> 00:00:08,640
OK.

3
00:00:08,820 --> 00:00:16,890
In the name of my variable with B X and then I assign a value to my valuable and at the end of my statement

4
00:00:16,980 --> 00:00:18,600
I need to put in a semicolon.

5
00:00:18,690 --> 00:00:19,320
OK.

6
00:00:19,440 --> 00:00:25,020
So first I want to output the value of this variable to the console to make sure that it's working.

7
00:00:25,380 --> 00:00:32,790
Print line and inside the prentices I just need to refer to the name of my variable and at the end of

8
00:00:32,790 --> 00:00:37,530
my statement I need to put in the same code on OK so if I write on my project as you can see it's going

9
00:00:37,530 --> 00:00:39,760
to output this value to the console.

10
00:00:39,780 --> 00:00:42,320
This is the value of the x variable here.

11
00:00:42,360 --> 00:00:42,990
OK.

12
00:00:43,140 --> 00:00:48,490
Now I want to actually create another variable here ain't Y.

13
00:00:49,260 --> 00:00:55,560
And I want to assign a value to my value but for example x plus plus and at the end of my statement

14
00:00:55,920 --> 00:00:57,960
I need to put in a semicolon.

15
00:00:57,960 --> 00:01:07,810
So here as you can see so here I can see why it is given the value of the x variable before it is incremented.

16
00:01:07,970 --> 00:01:08,760
OK.

17
00:01:09,360 --> 00:01:18,300
Because I used this postfix operator here the value of these x variable is going to be assigned to the

18
00:01:18,910 --> 00:01:23,990
rivalry at Bell and then the value of this variable will be incremented.

19
00:01:24,020 --> 00:01:30,680
OK so if I actually output the value of this very variable to the console system that out that print

20
00:01:30,680 --> 00:01:35,470
land and the inside Apprentice's I just need to refer to the name of one variable.

21
00:01:35,490 --> 00:01:45,310
So first when I actually put in some text here this is the value of my voice value.

22
00:01:45,360 --> 00:01:46,120
OK.

23
00:01:49,400 --> 00:01:50,180
OK.

24
00:01:50,630 --> 00:01:53,720
And then I need to refer to the name of my variable.

25
00:01:53,750 --> 00:01:54,170
Why.

26
00:01:54,230 --> 00:01:54,770
OK.

27
00:01:54,950 --> 00:01:57,980
And at the end of my statement I need to put in a semi-colon.

28
00:01:58,430 --> 00:02:04,800
So if I run my project now as you can see it's going to actually output this value to the console.

29
00:02:05,030 --> 00:02:07,990
This is the value of my very valuable 42.

30
00:02:08,100 --> 00:02:08,600
OK.

31
00:02:08,720 --> 00:02:15,890
Even though I use these plus plus operator on my variable name it didn't actually assign the incremented

32
00:02:15,890 --> 00:02:22,300
value to my wife value it because I use this postfix operator on my variable name first.

33
00:02:22,520 --> 00:02:29,390
It actually assigned the value of this valuable to my view variable and then it incremented the value

34
00:02:29,390 --> 00:02:31,280
of this x variable by 1.

35
00:02:31,370 --> 00:02:32,300
As you can see here.

36
00:02:32,380 --> 00:02:33,030
OK.

37
00:02:33,230 --> 00:02:42,110
If I actually want to output the value of this variable to the console system that out that printed

38
00:02:42,120 --> 00:02:42,400
on

39
00:02:47,100 --> 00:02:50,900
and then inside the prentices I just need to refer to the name of my variable.

40
00:02:50,990 --> 00:02:52,870
So I just put in some text here.

41
00:02:52,940 --> 00:02:58,100
This is the value of my

42
00:03:01,520 --> 00:03:08,460
X Y Z and after incrementing it's value OK.

43
00:03:12,960 --> 00:03:14,730
It's value by what.

44
00:03:15,380 --> 00:03:16,480
OK.

45
00:03:17,970 --> 00:03:24,580
So here I use the plus operator in order to concatenate this text with my variable name.

46
00:03:24,660 --> 00:03:32,000
So I just put in the variable name here and at the end of my statement I need to put in a semi-colon.

47
00:03:32,190 --> 00:03:32,780
OK.

48
00:03:33,090 --> 00:03:39,790
So now if you run my project as you can see it's going to output this value here to the console.

49
00:03:39,830 --> 00:03:47,150
OK this is the value of my x variable after incrementing its value by 1 OK for free.

50
00:03:47,190 --> 00:03:49,130
This is the value of my x variable.

51
00:03:49,130 --> 00:03:57,480
After incrementing its value by 1 in this line of code here OK I use the postfix operator on my variable

52
00:03:57,480 --> 00:03:58,100
name here.

53
00:03:58,200 --> 00:03:59,060
OK.

54
00:03:59,460 --> 00:04:05,070
And because I used the post this operator on my variable name for it it's going to actually assign the

55
00:04:05,070 --> 00:04:12,690
value of this variable which is 42 to my view variable here and then it's gonna actually increment the

56
00:04:12,690 --> 00:04:21,210
value of this variable which is 42 by 1 and the value of this variable will be 40 free.

57
00:04:21,360 --> 00:04:29,160
So in this line of code in line 71 I decided to output the value of this valuable to the console in

58
00:04:29,160 --> 00:04:34,310
order to show you that the value of the x value but is now incremented.

59
00:04:34,350 --> 00:04:35,150
OK.

60
00:04:35,700 --> 00:04:45,620
So now if I actually use the prefix operator on my variable name here minus minus x.

61
00:04:45,900 --> 00:04:50,720
Ok so now let's actually run our project and see what happens.

62
00:04:51,570 --> 00:04:56,020
So as you can see here the value of my very valuable is 41.

63
00:04:56,120 --> 00:04:56,630
Okay.

64
00:04:56,640 --> 00:05:00,780
And the value of my x variable is 41.

65
00:05:01,020 --> 00:05:01,870
As you can see here.

66
00:05:01,940 --> 00:05:02,770
OK.

67
00:05:02,970 --> 00:05:10,980
So because I use the prefix operator here first is going to actually decrement the value of this x variable

68
00:05:10,980 --> 00:05:18,730
here which is 42 by 1 and then it's gonna assign that value to my view variable here.

69
00:05:18,750 --> 00:05:25,150
So as you can see in the console the value of my right the value of my value variable is 41.

70
00:05:25,250 --> 00:05:26,040
OK.

71
00:05:26,100 --> 00:05:32,290
So in line 71 as you can see here the value of my x variable is 41.

72
00:05:32,430 --> 00:05:35,800
OK because of this line of code here as you can see.

73
00:05:36,160 --> 00:05:36,520
OK.

74
00:05:36,540 --> 00:05:40,170
So that's it for actually incrementing and decrementing in Java.

75
00:05:40,180 --> 00:05:40,760
OK.

76
00:05:40,980 --> 00:05:48,210
So if you have any questions about these concepts that are actually taught to you in this lecture please

77
00:05:48,210 --> 00:05:53,130
post a discussion in the course and ask your questions and then I'll answer all of your questions.

78
00:05:53,130 --> 00:05:53,550
OK.

79
00:05:53,550 --> 00:05:59,480
So thank you very much for watching this tutorial and I'll see you in the next tutorial.

