1
00:00:00,660 --> 00:00:03,230
The value of Wahls is outputted to the console.

2
00:00:03,240 --> 00:00:03,800
OK.

3
00:00:03,920 --> 00:00:08,810
So this false value is the last value that be assigned to this value.

4
00:00:09,080 --> 00:00:12,890
Now I want to give you some examples about Constance.

5
00:00:12,920 --> 00:00:13,590
OK.

6
00:00:13,880 --> 00:00:21,010
If the value should never change during our programs run time you can use a type of variable called

7
00:00:21,190 --> 00:00:21,940
a constant.

8
00:00:21,950 --> 00:00:22,590
OK.

9
00:00:22,850 --> 00:00:29,660
To declare a constant use the final keyboard before the variable declaration and actually assign an

10
00:00:29,690 --> 00:00:31,910
initial value to that variable.

11
00:00:31,910 --> 00:00:32,420
OK.

12
00:00:32,480 --> 00:00:37,440
So now you want to show you some real examples about constants.

13
00:00:37,460 --> 00:00:38,170
OK.

14
00:00:38,390 --> 00:00:41,860
So here I declare an integer variable.

15
00:00:41,900 --> 00:00:42,190
OK.

16
00:00:42,200 --> 00:00:45,830
As you can see and I assign a value to this variable.

17
00:00:46,070 --> 00:00:50,240
So now I want to output the value of this roudy about to the console.

18
00:00:50,250 --> 00:00:50,760
OK.

19
00:00:50,990 --> 00:00:57,170
System that out that princeling and then insider practice's just referred to the name of this value.

20
00:00:57,310 --> 00:00:58,250
OK.

21
00:00:58,380 --> 00:01:03,890
And run your project as you can see the value of Pertti is now out with it to the console.

22
00:01:03,890 --> 00:01:04,850
OK.

23
00:01:05,660 --> 00:01:11,410
So now I want to actually assign another value to this variable.

24
00:01:11,420 --> 00:01:12,810
For example number 50.

25
00:01:12,820 --> 00:01:13,450
OK.

26
00:01:13,640 --> 00:01:20,090
So now I want to output the value of this variable to the console system that out that adrenaline and

27
00:01:20,090 --> 00:01:23,740
an inside Apprentice's just referred to the name of this variable.

28
00:01:23,840 --> 00:01:30,280
Ok so if I run my project now as against it's going to output the value of 50 to the console.

29
00:01:30,290 --> 00:01:31,020
OK.

30
00:01:31,460 --> 00:01:39,020
So now as I said earlier to declare a constant you need to actually put the final keyboard before the

31
00:01:39,020 --> 00:01:43,730
variable declaration and include an initial value for that value.

32
00:01:43,760 --> 00:01:44,450
OK.

33
00:01:44,930 --> 00:01:52,010
So here if I actually put the final keyword before the variable declaration as you can see is now showing

34
00:01:52,010 --> 00:01:57,250
me an error on the line 77 because this variable is a constant.

35
00:01:57,350 --> 00:02:00,760
And we cannot add another value to a constant.

36
00:02:00,820 --> 00:02:05,420
OK so this is a very important point about constants.

37
00:02:05,540 --> 00:02:08,600
So we must delete this line of code here.

38
00:02:08,900 --> 00:02:11,430
And as you can see the error is now gone.

39
00:02:11,510 --> 00:02:17,200
And if I run my project now as you can see it outputs only the value for the console.

40
00:02:17,270 --> 00:02:24,250
OK so now if I want to actually add another value to this variable as you can see it is now again showing

41
00:02:24,260 --> 00:02:25,180
us an error.

42
00:02:25,340 --> 00:02:32,930
And it doesn't allow us to add another value to this variable because this variable is a constant.

43
00:02:32,990 --> 00:02:35,960
And now let me give you another example.

44
00:02:35,960 --> 00:02:36,460
OK.

45
00:02:36,590 --> 00:02:43,520
So first we put in the final keyboard and then the data of are valuable and then we get our valuable

46
00:02:43,570 --> 00:02:44,080
a name.

47
00:02:44,090 --> 00:02:44,570
OK.

48
00:02:44,690 --> 00:02:47,580
And then we assign a value to our value.

49
00:02:47,630 --> 00:02:48,280
Okay.

50
00:02:48,560 --> 00:02:53,640
And then I want to actually output the value of this variable to the console.

51
00:02:53,690 --> 00:02:55,730
So system that out that's being stolen.

52
00:02:55,910 --> 00:03:01,640
And then inside Apprentice's just revert to the name of that variable and a comment out these lines

53
00:03:01,640 --> 00:03:08,150
of code and then run my project as you can see it outputs the value of this variable to the console.

54
00:03:08,150 --> 00:03:08,710
OK.

55
00:03:08,900 --> 00:03:15,090
So now if you want to actually assign another value to this variable OK.

56
00:03:15,200 --> 00:03:21,410
It doesn't allow us to do it because we cannot add another value to a constant.

57
00:03:21,410 --> 00:03:22,070
OK.

58
00:03:22,130 --> 00:03:27,970
And if you for example delete that final keyword as you can see here.

59
00:03:28,250 --> 00:03:29,800
Now the error is gone.

60
00:03:29,810 --> 00:03:30,300
OK.

61
00:03:30,410 --> 00:03:37,280
And if I put back that final keyboard as you can see here now it's doing me an error again because we

62
00:03:37,280 --> 00:03:40,880
can't assign another value to a constant.

63
00:03:40,910 --> 00:03:46,060
OK so that's enough for this tutorial.

64
00:03:46,070 --> 00:03:53,540
We will be using these primitive data types later in the course when we are actually creating Java and

65
00:03:53,690 --> 00:03:55,410
Android applications.

66
00:03:55,640 --> 00:03:56,390
OK.

67
00:03:56,660 --> 00:04:01,970
So ask any questions that you want about these concepts.

68
00:04:01,970 --> 00:04:07,430
You can either message me or you can create a discussion in the course.

69
00:04:07,500 --> 00:04:11,080
And thanks for watching and I'll see you in the next tutorial.

