All language subtitles for 358540-038 - Methods varargs + Demo - Java In-Depth Become a Complete Java Engineer!.en_US

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English Download
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi Download
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian Download
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu Download
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,110 --> 00:00:09,210 Not look at a feature that was introduced in Jollof by Karl Marx before Jolliffe I meant it could only 2 00:00:09,210 --> 00:00:12,130 be invoked with fixed number of arguments. 3 00:00:12,480 --> 00:00:18,030 That is you may have a method that has three parameters and so you can look at that exactly the arguments 4 00:00:18,030 --> 00:00:18,800 . 5 00:00:18,900 --> 00:00:24,230 But that needn't be the case from giallo 5 onwards from Delphi onwards. 6 00:00:24,360 --> 00:00:30,900 Methods can have a special type of parameter called quarks which is shorthand for variable length arguments 7 00:00:32,760 --> 00:00:37,740 and as the name suggests this parameter can become variable number of arguments. 8 00:00:37,950 --> 00:00:44,340 There is even though it's a single parameter it can take either 0 or 1 or even more than one argument 9 00:00:44,420 --> 00:00:45,560 as in. 10 00:00:45,960 --> 00:00:50,020 Also it's got to be the last parameter of the method. 11 00:00:50,040 --> 00:00:52,930 It can also be the only parameter of the method. 12 00:00:53,280 --> 00:00:58,260 So it could be the only parameter of a method or if the matter has more than one parameter then the 13 00:00:58,260 --> 00:01:02,190 broader experimenter must be the last one. 14 00:01:02,190 --> 00:01:09,600 Now let's look at the syntax of a broad experimenter and also have the invocation looks like syntax 15 00:01:09,620 --> 00:01:11,500 in most three dots are ellipses. 16 00:01:11,550 --> 00:01:18,450 Following the parameter type and here is an example as you can see the parameter type and is followed 17 00:01:18,450 --> 00:01:21,220 by three dots. 18 00:01:21,310 --> 00:01:30,780 Now when it comes to any location the corresponding argument can be an array of any size or it can also 19 00:01:30,780 --> 00:01:35,310 be a sequence off any number of comma separated arguments. 20 00:01:35,310 --> 00:01:41,340 As you can see the values run butare are simply being passed as comma separated values in this because 21 00:01:41,340 --> 00:01:44,480 the compiler automatically can merge them into an array. 22 00:01:45,000 --> 00:01:50,040 So basically the arguments are getting passed as an array whether you do it explicitly or not. 23 00:01:50,340 --> 00:01:54,610 This also means that the blot on experimentor in the method definition is also an order. 24 00:01:55,080 --> 00:02:00,400 So when we compile the compiler automatically converts of what I've spent ometer into an array. 25 00:02:00,990 --> 00:02:07,050 So that in the method the watch parameter is treated as any normality. 26 00:02:07,380 --> 00:02:10,530 Finally the last argument could be omitted altogether. 27 00:02:11,010 --> 00:02:17,310 So in one example the method for is invoked with only the boolean argument internally and MPO it will 28 00:02:17,310 --> 00:02:20,360 be passed without blocks barometer. 29 00:02:20,370 --> 00:02:23,350 So basically the number of parameters has been fixed. 30 00:02:23,520 --> 00:02:29,580 It's just that the parts parameter gives the flexibility in passing either 0 or more argument values 31 00:02:29,580 --> 00:02:30,380 . 32 00:02:30,570 --> 00:02:37,200 It just gives an illusion that the method is infinitely overloaded. 33 00:02:37,520 --> 00:02:38,850 Dumps of restrictions. 34 00:02:38,850 --> 00:02:43,920 I just want to reiterate that the water experimentor must be the last barometer when the method has 35 00:02:43,920 --> 00:02:51,030 more than one parameter and the restriction is that a metric cannot how more than one product barometer 36 00:02:51,040 --> 00:02:51,350 . 37 00:02:51,640 --> 00:02:53,240 OK. 38 00:02:53,850 --> 00:03:00,630 Next is the question itself why products can't we simply use an array as parameter which can also take 39 00:03:00,630 --> 00:03:03,690 really the moral values. 40 00:03:04,200 --> 00:03:05,500 Of course we can do that. 41 00:03:05,730 --> 00:03:11,740 But the main advantage of products is that it provides us with more simpler unflexible in rockish mechanism 42 00:03:12,600 --> 00:03:13,600 . 43 00:03:13,860 --> 00:03:16,000 That is if you don't how many values to pass. 44 00:03:16,050 --> 00:03:22,770 You can simply pass a mask coalmines operator values and if there is nothing to pass you simply need 45 00:03:22,770 --> 00:03:24,590 not pass anything at all. 46 00:03:24,780 --> 00:03:30,210 That is you don't have to pass null on an empty at it the compiler automatically passes an empty threat 47 00:03:30,210 --> 00:03:30,890 . 48 00:03:31,110 --> 00:03:37,890 So that's just a cleaner syntax on it because if you have a large number of values to pass you can simply 49 00:03:37,890 --> 00:03:40,870 gather them into an array and pass it to them. 50 00:03:41,160 --> 00:03:43,250 So that's a main advantage of blocks. 51 00:03:43,260 --> 00:03:49,350 It gives us a more simpler and flexible invocation mechanism. 52 00:03:49,350 --> 00:03:54,420 There's a method called Print def which was introduced in Jollof I understood a very nice example of 53 00:03:54,420 --> 00:03:55,910 using Bartok's. 54 00:03:56,100 --> 00:04:01,260 It's basically used to print formatted text and disseminate the print L.N. and then statements that 55 00:04:01,260 --> 00:04:02,750 we already know. 56 00:04:03,120 --> 00:04:09,180 First parameter is the text to be appended while the second isn't what x parameter type of the second 57 00:04:09,180 --> 00:04:14,050 parameter here is object which is a class in Java and we can look at it later. 58 00:04:14,670 --> 00:04:16,370 Let's look at this example in location. 59 00:04:16,410 --> 00:04:21,600 That's printing data but here the first argument is the text to be printed. 60 00:04:21,880 --> 00:04:26,550 Well second third and fourth arguments correspond to the warhawks parameter. 61 00:04:26,550 --> 00:04:30,010 You can also see three person dead symbols in the first argument. 62 00:04:30,180 --> 00:04:36,300 Basically at runtime the printf method would replace the three person dead symbols with a three argument 63 00:04:36,300 --> 00:04:42,830 values 1 1 and 1978 that are pastor's input to the experimenter. 64 00:04:42,870 --> 00:04:47,220 So basically person does ambos so s placeholders here. 65 00:04:47,220 --> 00:04:52,180 So that's one good example from the Java library itself. 66 00:04:52,200 --> 00:04:55,230 Next we know that this is a definition of Main method. 67 00:04:55,860 --> 00:05:03,710 No it blocks it's perfectly valid to replace the input array parameter of what water barometer. 68 00:05:03,820 --> 00:05:09,120 Next there are certain rules that we need to be at off when it comes to using broad method as an overloaded 69 00:05:09,120 --> 00:05:10,500 method. 70 00:05:11,430 --> 00:05:14,280 Let's look at the first rule using an example. 71 00:05:15,180 --> 00:05:18,820 Let's see if we have this what method call foo. 72 00:05:19,470 --> 00:05:24,430 Then we cannot have an overloaded non-God method that looks like this. 73 00:05:24,720 --> 00:05:30,680 So it would be an invalid order as you can see the signature is exactly identical Savatage. 74 00:05:30,770 --> 00:05:34,570 Barometer is simply an array to. 75 00:05:35,370 --> 00:05:41,280 Next if you have a bunch of overloaded methods and if one of them is a wad oximeter then doing method 76 00:05:41,290 --> 00:05:46,050 invocation the blocks method will be the last one to be matched. 77 00:05:47,130 --> 00:05:48,700 Let's actually look at a simpler time off. 78 00:05:48,700 --> 00:05:55,880 This second rule variegata method will be the last one to be matched Spoonman. 79 00:05:56,010 --> 00:05:58,720 That's how I've been added to the basics class. 80 00:05:59,040 --> 00:06:04,680 And since there are overloaded methods both of them have the same name and they have been named S-box 81 00:06:04,830 --> 00:06:09,010 since it's a lot Arc's demo and since it's overloading them also. 82 00:06:09,030 --> 00:06:11,410 So when it blocks or whatever. 83 00:06:11,670 --> 00:06:14,430 OK so these are the two methods. 84 00:06:14,480 --> 00:06:16,590 Let's look at the input parameters here. 85 00:06:16,600 --> 00:06:24,330 So this this one does not have an ox parameter so it has a boolean parameter on three regular parameters 86 00:06:24,330 --> 00:06:24,900 . 87 00:06:24,900 --> 00:06:27,180 Second one is a warhawks method. 88 00:06:27,240 --> 00:06:31,240 The second method has what x parameter so it has a boolean parameter. 89 00:06:31,320 --> 00:06:33,730 And here is the what x parameter. 90 00:06:33,870 --> 00:06:38,500 OK and here we are printing in the first metor we are saying inside quarks or not. 91 00:06:38,520 --> 00:06:42,860 But without what on X and the second we are saying insert Warlock's or not. 92 00:06:42,900 --> 00:06:44,370 But with what ARX. 93 00:06:44,380 --> 00:06:48,180 OK and we're also printing the length of the input parameter. 94 00:06:48,210 --> 00:06:52,010 Ok since this is an array we are printing done lento. 95 00:06:52,220 --> 00:06:55,810 OK now let's look at the invocation statements here. 96 00:06:55,980 --> 00:06:57,950 So we have three invoke mission statements. 97 00:06:58,180 --> 00:07:03,480 OK one of them is passing through and the ralliers one to 3 and the second one is passing through on 98 00:07:03,690 --> 00:07:08,660 one to 8 values here and the fourth one is just passing on the boolean argument. 99 00:07:08,740 --> 00:07:16,440 OK and so in the first case it were frustrated as we discussed earlier that it would first try to find 100 00:07:16,440 --> 00:07:19,200 an exact match in this because there is an exact match. 101 00:07:19,340 --> 00:07:23,400 One boolean on the 2:59 bluesman fit here. 102 00:07:23,490 --> 00:07:29,620 So in this case the first order of the method gets invoked in the second and the third case. 103 00:07:29,670 --> 00:07:36,090 Since there is no exact match the the second overloaded method will be picked which is a white box which 104 00:07:36,090 --> 00:07:37,110 is a warhawks method. 105 00:07:37,170 --> 00:07:43,140 OK hon will the length of the array in this case it would be 8 iron in the second case in that in the 106 00:07:43,140 --> 00:07:44,970 last example it would be zero. 107 00:07:45,160 --> 00:07:48,660 OK so let's just go ahead and compile and execute this. 108 00:07:48,690 --> 00:07:52,120 So I'm in the basics directory. 109 00:07:52,910 --> 00:08:00,180 OK so as you can see here with the first invocation it is inserted but ours a lot but without what varargs 110 00:08:00,180 --> 00:08:00,290 . 111 00:08:00,300 --> 00:08:06,360 So that's the first method and for the second invocation where you are passing 8 ralliers comma separated 112 00:08:06,360 --> 00:08:07,060 values. 113 00:08:07,170 --> 00:08:09,170 So it is in sidewards overload. 114 00:08:09,230 --> 00:08:14,190 Read watch on it bench the lines of the array which is on the final one where you are passing just a 115 00:08:14,190 --> 00:08:17,950 boolean at Bernd's zero as the last. 116 00:08:18,030 --> 00:08:20,100 OK so that's about it. 117 00:08:20,100 --> 00:08:24,630 So that's the autoloading feature retrospect do what oximeter. 118 00:08:24,690 --> 00:08:26,460 OK so just go ahead and play with it. 119 00:08:26,460 --> 00:08:30,050 You can also pass arrays here instead of just call my separated values. 120 00:08:30,120 --> 00:08:36,120 So just go ahead and play with it and you can also find the updated program and the resources section 121 00:08:36,120 --> 00:08:36,720 . 122 00:08:36,720 --> 00:08:37,300 All right then. 123 00:08:37,320 --> 00:08:38,670 Thank you. 11742

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.