1 00:00:00,720 --> 00:00:03,990 ‫Instructor: Hi, we have been working with variables 2 00:00:03,990 --> 00:00:07,560 ‫for some time, and one of the reasons that we call them 3 00:00:07,560 --> 00:00:10,890 ‫variables is that we can vary the value 4 00:00:10,890 --> 00:00:12,990 ‫after we create them. 5 00:00:12,990 --> 00:00:16,440 ‫For example, we have changed the double z, 6 00:00:16,440 --> 00:00:18,540 ‫if you remember to before, 7 00:00:18,540 --> 00:00:22,380 ‫after we have initialized it with five. 8 00:00:22,380 --> 00:00:26,280 ‫We can do that with any variables that we want, 9 00:00:26,280 --> 00:00:28,980 ‫but if we cast them as final, 10 00:00:28,980 --> 00:00:31,920 ‫if we create them with final keyword, 11 00:00:31,920 --> 00:00:35,250 ‫that means that it cannot be changed. 12 00:00:35,250 --> 00:00:36,720 ‫So let me show you what I mean. 13 00:00:36,720 --> 00:00:39,630 ‫Let me create an integer called myInteger. 14 00:00:39,630 --> 00:00:41,400 ‫And it's five. 15 00:00:41,400 --> 00:00:44,280 ‫Then I can just call my integer 16 00:00:44,280 --> 00:00:48,570 ‫to be any other value whenever I want, okay? 17 00:00:48,570 --> 00:00:52,920 ‫Now, if I run this, okay? 18 00:00:52,920 --> 00:00:57,920 ‫If I print out my integer over here, it will be run, 19 00:00:59,040 --> 00:01:03,780 ‫and it will be showing the value of five to me. 20 00:01:03,780 --> 00:01:08,220 ‫For example, let me do it like this, myInteger, okay? 21 00:01:08,220 --> 00:01:09,873 ‫And + myInteger. 22 00:01:11,490 --> 00:01:16,490 ‫So this will show me the results of my integer. 23 00:01:16,950 --> 00:01:20,850 ‫And one of the most important things that you should know 24 00:01:20,850 --> 00:01:25,230 ‫is that these codes are run in order. 25 00:01:25,230 --> 00:01:28,920 ‫So right now I'm seeing my my integer is five, 26 00:01:28,920 --> 00:01:31,890 ‫and if I do it here, okay? 27 00:01:31,890 --> 00:01:35,100 ‫If I write the exact same thing 28 00:01:35,100 --> 00:01:39,750 ‫now I will see my integer is four in the logs, 29 00:01:39,750 --> 00:01:43,590 ‫because these are run in order. 30 00:01:43,590 --> 00:01:46,290 ‫As you can see, my integer was five, 31 00:01:46,290 --> 00:01:51,180 ‫there I changed it to four, and I printed out as four. 32 00:01:52,140 --> 00:01:57,140 ‫But if I add final keyword over here, 33 00:01:57,210 --> 00:02:00,630 ‫then I cannot change the value 34 00:02:00,630 --> 00:02:03,030 ‫of my integer at this point on. 35 00:02:03,030 --> 00:02:06,960 ‫As you can see it says that you cannot assign a value 36 00:02:06,960 --> 00:02:08,640 ‫to a final variable. 37 00:02:08,640 --> 00:02:11,160 ‫So this is kind of a constant, 38 00:02:11,160 --> 00:02:15,240 ‫it cannot be changed after all. 39 00:02:15,240 --> 00:02:20,003 ‫So you cannot do that once you declare a variable final. 40 00:02:20,940 --> 00:02:25,290 ‫So if you have in a case like this 41 00:02:25,290 --> 00:02:28,140 ‫that you have to create a variable 42 00:02:28,140 --> 00:02:32,430 ‫and you don't want the value to be changed after all, 43 00:02:32,430 --> 00:02:35,640 ‫then you should mark it with final keyword. 44 00:02:35,640 --> 00:02:38,640 ‫If it's not the case, then you shouldn't bother 45 00:02:38,640 --> 00:02:42,090 ‫with the final keyword at all. 46 00:02:42,090 --> 00:02:44,040 ‫So most of the time we don't want this, 47 00:02:44,040 --> 00:02:47,100 ‫because we may want to change the value, 48 00:02:47,100 --> 00:02:49,800 ‫but if you come across in a situation like this 49 00:02:49,800 --> 00:02:51,810 ‫and if you see a final keyboard, 50 00:02:51,810 --> 00:02:54,270 ‫it means that it's a constant, 51 00:02:54,270 --> 00:02:58,290 ‫It shouldn't be changed after all, and you cannot do that. 52 00:02:58,290 --> 00:03:02,313 ‫As you can see, if we try to run this, we will get an error. 53 00:03:03,360 --> 00:03:05,250 ‫So here you go. 54 00:03:05,250 --> 00:03:08,280 ‫Now you know what's a variable, 55 00:03:08,280 --> 00:03:09,840 ‫you know what's a constant, 56 00:03:09,840 --> 00:03:12,840 ‫or at least you know what's a final keyword. 57 00:03:12,840 --> 00:03:17,103 ‫Now we can move on with the other data structures.