1 00:00:00,390 --> 00:00:01,400 ‫Welcome back. 2 00:00:01,410 --> 00:00:09,650 ‫I hope you managed to write the method and the variables required for this code to run and you finished 3 00:00:09,650 --> 00:00:10,350 ‫the challenge. 4 00:00:10,350 --> 00:00:14,910 ‫So let's go ahead and create the variables of our friends. 5 00:00:14,910 --> 00:00:24,300 ‫So first of all, I'm going to create a variable called Friend one, and it's going to be frank then 6 00:00:25,560 --> 00:00:37,290 ‫friend two, which is going to be Michael and String Friend three which is going to be blood. 7 00:00:38,310 --> 00:00:39,450 ‫All right, so there we are. 8 00:00:39,450 --> 00:00:41,070 ‫We have our three friends. 9 00:00:41,070 --> 00:00:45,540 ‫And now I want to have a method which greets all of those friends. 10 00:00:45,990 --> 00:00:52,260 ‫And I need to call this method multiple times, of course, so I can pre agreed friend one, then free 11 00:00:52,290 --> 00:00:54,210 ‫friend two and then friend three. 12 00:00:54,210 --> 00:00:56,550 ‫And I'm going to create the method here. 13 00:00:57,030 --> 00:01:08,940 ‫Public static greet friend and in here I will need a string called friend name. 14 00:01:10,680 --> 00:01:14,220 ‫And you might have used a different name here. 15 00:01:14,220 --> 00:01:19,020 ‫By the way, we need to use void here because we don't return anything. 16 00:01:19,230 --> 00:01:25,440 ‫So as you can see, the error disappeared and now we can go ahead and write onto our console. 17 00:01:25,950 --> 00:01:40,410 ‫So write a line onto the console and this will give us something like Hi, then the name of the friend 18 00:01:41,970 --> 00:01:52,590 ‫plus friend, name plus comma, my friend, and of course, the exclamation mark. 19 00:01:52,620 --> 00:01:53,820 ‫All right, so there we are. 20 00:01:53,850 --> 00:01:54,840 ‫That's our method. 21 00:01:54,840 --> 00:01:58,650 ‫Now, of course, we need to call that method in here. 22 00:01:58,680 --> 00:01:59,850 ‫Greet friend. 23 00:01:59,850 --> 00:02:01,020 ‫And who is it? 24 00:02:01,020 --> 00:02:08,070 ‫It's friend one, then it's friend two and it's friend three. 25 00:02:08,070 --> 00:02:14,520 ‫So I'm just going to copy that and I'm going to replace one and one twice. 26 00:02:15,030 --> 00:02:15,570 ‫All right. 27 00:02:15,570 --> 00:02:22,500 ‫But that's not going to be enough because I will need console dot right at the end so that something 28 00:02:22,500 --> 00:02:26,010 ‫will show up onto the console or on the console. 29 00:02:26,010 --> 00:02:29,640 ‫So let's run that code and see what we get there. 30 00:02:31,490 --> 00:02:32,450 ‫And we are. 31 00:02:32,480 --> 00:02:33,720 ‫Hi, Frank, my friend. 32 00:02:33,740 --> 00:02:34,850 ‫Hi, Michael, my friend. 33 00:02:34,850 --> 00:02:35,990 ‫Hi, Vlad, my friend. 34 00:02:36,290 --> 00:02:39,140 ‫All right, so that's one way to solve it. 35 00:02:39,350 --> 00:02:42,590 ‫You could have, of course, solved it that way as well. 36 00:02:42,590 --> 00:02:50,720 ‫So you could have solved it with name two and String Friend, name three. 37 00:02:51,260 --> 00:02:53,570 ‫And then you could have simply. 38 00:02:55,570 --> 00:02:56,530 ‫Called. 39 00:02:58,780 --> 00:03:07,240 ‫The myth that three times the red line method and instead called grid friend only once here. 40 00:03:08,200 --> 00:03:14,440 ‫So grid friend friend one, friend two and friend three. 41 00:03:15,430 --> 00:03:17,560 ‫That will result in the same thing. 42 00:03:18,490 --> 00:03:19,460 ‫And you see. 43 00:03:19,480 --> 00:03:20,550 ‫Hi, Frank, my friend. 44 00:03:20,560 --> 00:03:21,610 ‫Hi, my friend. 45 00:03:21,610 --> 00:03:22,490 ‫And so forth. 46 00:03:22,510 --> 00:03:24,160 ‫So these are the two options. 47 00:03:24,160 --> 00:03:27,610 ‫This one is the one with multiple parameters. 48 00:03:27,610 --> 00:03:33,790 ‫And you don't need to call the grid grid friend method multiple times only once. 49 00:03:33,790 --> 00:03:38,260 ‫But well, let's just depending on the style you want to use. 50 00:03:38,830 --> 00:03:39,190 ‫Great. 51 00:03:39,190 --> 00:03:40,960 ‫I hope you could solve that yourself. 52 00:03:40,960 --> 00:03:42,000 ‫And now? 53 00:03:42,010 --> 00:03:42,250 ‫Yeah. 54 00:03:42,280 --> 00:03:48,010 ‫Feel free to try around with some other methods, create some methods and play around with this because 55 00:03:48,010 --> 00:03:50,050 ‫we will need methods a lot. 56 00:03:50,050 --> 00:03:55,060 ‫And of course, while we're using them in the next videos, you will get a better feeling for them and 57 00:03:55,060 --> 00:04:01,150 ‫will get a deeper understanding of what those are about and how to use them correctly. 58 00:04:01,420 --> 00:04:01,840 ‫Great. 59 00:04:01,840 --> 00:04:04,420 ‫So see you in the next video.