1 00:00:00,150 --> 00:00:03,840 Before we start, did you try solving the workbook yourself? 2 00:00:03,870 --> 00:00:09,630 If not, please click the link in the resources folder and follow the instructions for this workbook. 3 00:00:10,840 --> 00:00:12,370 This video will go through the solution. 4 00:00:12,370 --> 00:00:14,320 Four Workbook 1.1. 5 00:00:14,410 --> 00:00:16,280 Here you'll see we have comments. 6 00:00:16,300 --> 00:00:20,460 A comment is just a bunch of text that comes after two front slashes. 7 00:00:20,470 --> 00:00:22,780 You can write whatever you want and comments. 8 00:00:22,780 --> 00:00:24,820 It makes no difference to your code. 9 00:00:25,210 --> 00:00:25,810 All right. 10 00:00:25,810 --> 00:00:27,990 We're just going to use the comments as a guide. 11 00:00:28,000 --> 00:00:31,000 So task one tells me to make a class. 12 00:00:31,150 --> 00:00:36,370 You'll remember that by default, when you auto generate a class, it starts with the public keyword. 13 00:00:36,370 --> 00:00:39,100 For the sake of consistency, we're going to do the same thing. 14 00:00:39,100 --> 00:00:43,810 You will understand level of access in module to object oriented programming. 15 00:00:43,810 --> 00:00:45,790 But for now, let's just follow through. 16 00:00:45,970 --> 00:00:47,740 Then we'll say public class. 17 00:00:47,740 --> 00:00:51,100 The class name has to always be the same as your file name. 18 00:00:51,100 --> 00:00:56,440 So first program and inside brackets is where we can write all of our code. 19 00:00:58,090 --> 00:00:59,920 Test two is inside the class. 20 00:00:59,920 --> 00:01:01,120 Write the main method. 21 00:01:01,690 --> 00:01:09,910 So if I just say main press the first option, it will autocomplete and you'll remember that this is 22 00:01:09,910 --> 00:01:11,710 where your code starts running. 23 00:01:11,710 --> 00:01:16,150 Main is the entry point, and here we have to print four messages. 24 00:01:16,150 --> 00:01:20,740 So we'll say system dot out, dot print line. 25 00:01:21,750 --> 00:01:25,650 And now I'll copy and paste this three more times. 26 00:01:26,190 --> 00:01:27,690 The message is that I need to print. 27 00:01:27,690 --> 00:01:29,100 Ah, right over here. 28 00:01:30,130 --> 00:01:31,540 Printing is fun. 29 00:01:33,800 --> 00:01:36,170 Java is better than Python. 30 00:01:47,340 --> 00:01:49,410 And my dog ate to my java. 31 00:01:52,440 --> 00:01:53,160 All right. 32 00:01:54,930 --> 00:01:58,200 Finally, I'm going to run my code using terminal commands. 33 00:01:59,200 --> 00:02:03,610 It seems I have another terminal open, so I will close it and stay on this one. 34 00:02:05,490 --> 00:02:08,940 First I will compile the code inside a first program Java. 35 00:02:08,940 --> 00:02:12,540 So Java compiler first program Java. 36 00:02:12,960 --> 00:02:16,280 Then I will run the compiled code using the Java Command. 37 00:02:16,290 --> 00:02:18,090 Java First program. 38 00:02:18,870 --> 00:02:19,590 All right. 39 00:02:19,590 --> 00:02:20,610 Success. 40 00:02:22,040 --> 00:02:26,590 If you want to visualize the runtime, mean is the entry point of your Java application. 41 00:02:26,600 --> 00:02:28,700 This is where Java starts running your code. 42 00:02:28,730 --> 00:02:32,090 The first line of code in main print printing is fun. 43 00:02:32,120 --> 00:02:37,400 The second one prints Java is better than Python and now Java looks for more code inside main. 44 00:02:37,400 --> 00:02:41,840 But there isn't any, so it reaches the end and your runtime terminates.