//----------------------- Generic Method ----------------------- public class Main { public static void main(String args[]) { Integer[] intArray = {1, 2, 3, 4, 5}; Double[] doubleArray = {5.5, 4.4, 3.3, 2.2, 1.1}; Character[] charArray = {'H', 'E', 'L', 'L', 'O'}; String[] stringArray = {"B","Y","E"}; System.out.print("Integer Array: "); displayArray(intArray); System.out.println(firstIndex(intArray)); System.out.print("Double Array: "); displayArray(doubleArray); System.out.println(firstIndex(doubleArray)); System.out.print("Character Array: "); displayArray(charArray); System.out.println(firstIndex(charArray)); System.out.print("String Array: "); displayArray(stringArray); System.out.println(firstIndex(charArray)); */ } // Generic method public static void displayArray(Thing[] array) { for(Thing x : array) { System.out.print(x+" "); } System.out.println(); } // Generic method with generic return type public static Thing firstIndex(Thing[] array) { return array[0]; } } //----------------------- Generic Class ----------------------- public class Main { public static void main(String args[]) { //bounded types = you can create the objects of a generic class to have data // of specific derived types ex.Number MyGenericClass myInt = new MyGenericClass(1,9); MyGenericClass myDouble = new MyGenericClass(3.14,1.01); //MyGenericClass myChar = new MyGenericClass('@','$'); //MyGenericClass myString = new MyGenericClass("Hello",'!'); System.out.println(myInt.getValue()); System.out.println(myDouble.getValue()); //System.out.println(myChar.getValue()); //System.out.println(myString.getValue()); } } // ---------------------------------------------------------------- public class MyGenericClass { Thing x; Thing2 y; MyGenericClass(Thing x, Thing2 y){ this.x = x; this.y = y; } public Thing2 getValue() { return y; } }
@TechnoSan092 жыл бұрын
thank you so much love u bro forever subscriber
@Crispeaks Жыл бұрын
Single-handedly taught me Generics and helped me complete an assignment in 30 minutes. Epic!
@tomaszkarolak61794 жыл бұрын
The best tutorials, I've ever seen on YT, thx bro!!!
@john81487 Жыл бұрын
I always go through one of these videos before starting my bootcamp lessons. It makes everything so much easier to get into.
@patrickjaposmack4573 Жыл бұрын
Excellent tutorial video about generic classes and methods!
@jojovstojo2 жыл бұрын
Bro this was the heaviest video of all till now ! Literally my brain just exploded ! But extremely simple and direct - So thank you for such a badass of a teacher
@karanbrar19343 жыл бұрын
That 1 dislike is from bro himself, just to keep himself humble... ;)
@angelcastineira25614 жыл бұрын
a lot of new stuff but really well explained, thanks!
@deeplife9654 Жыл бұрын
Let start a campaign to give bro best teacher on youtube award !!!!! ❤❤❤❤❤❤❤ .
@larkinthesky10 ай бұрын
You, my dear Sir, are a legend. Thank you so much for all these incredibly useful instructional videos.
@furki35563 жыл бұрын
you have really the best tutorials I have ever seen, thank you. greetings from germany
@ravenguirao9081 Жыл бұрын
Thanks, I finally understand Generics, some code training/bootcamps explain it really complicated.. but with you i realized it's just that simple.
@rex.kishore Жыл бұрын
Well said Bro, you did exactly what we want. The Duration with perfect explanation, great effort that you spend on it. It pay off man. Good Luck ...
@ChrisTDBCODEАй бұрын
My professor sucks and ever since I started coming here instead of their lectures, my grade went from a B to an A. Thank you Brofessor!
@brianwkinyua2 ай бұрын
very clear and comprehensive. thank you again.
@weonios5 ай бұрын
The best video for Generics I have ever seen, and the examples are pretty nice!
@faniliana3 жыл бұрын
This would be the best java tutorial videos out there. Thank you bro
@mohammadreza_armanАй бұрын
Good job bro. That's exactly how you teach sth. I'm very glad that I found this amazing channel. Keep going on
@av26782 жыл бұрын
Wow! Generic is so damn useful. I wish i saw this video yesterday lol but still, better than never. Well explained too
@roxorsrule86043 жыл бұрын
Wow, I'm glad I found your channel. You style is crystal clear and to the point. Although I'm taking other classes you clarify the points I was having trouble with. Thanks man!
@jesseemana95982 жыл бұрын
this channel is a gold mine
@sinmeyyy3 жыл бұрын
Really the best tutorials on KZbin, that I've seen, keep up the good work Bro!
@SolutionByBrain1 Жыл бұрын
You are so smart to simplify such big task in a simple ways Thank you bro! Of Eritrea 🇪🇷
@victoriagee10593 жыл бұрын
Your code is so clean. You really know what you are doing!!!!
@ginasomara2673 жыл бұрын
most helpful generics video on the internet. hands down
I just learned more from a twenty minute video than a two hour lecture from my professor. You have a new bro.
@НікітаОрлов-с3ч Жыл бұрын
You are the best !!! Thanks for lessons in 2023
@Naanu_kartik3 жыл бұрын
concept cleared 🙌 Thanks Bro...and you have an unique way of explaining the things.
@benderbg Жыл бұрын
Great explanation of an important topic. Thanks Bro!
@chris07ism Жыл бұрын
Thanks again for another relatively simple concept explained in a brilliant way.
@sergeyb60714 жыл бұрын
wow that's a lot of stuff in one tutorial 🤯👍
@Snowmanver22 жыл бұрын
best channel with best tutorials out there!
@atongpayatoyatu27603 жыл бұрын
what the hell so good java tutorial i ever saw in youtube. thank you very much!
@kkspuder9 ай бұрын
really thx bro, though i'm watched some videos about generics, i'm still struggling with its use, here's some examples also other videos i watched but i'm not got a good understanding until you open the ArrayList class, everything is clear, i got the key point , this is really a nice video
@OnlyOneGedeon3 жыл бұрын
Thank you for this very helpful video
@v1krv3 жыл бұрын
Well explained
@anonimanonim12232 жыл бұрын
Great
@waleedharalkathiri18363 жыл бұрын
THE BEST EVER EXPLENATION OF GENERIC CLASS AND METHODS IN KZbin HISTORY🤣
@Remolhunter973 жыл бұрын
Best tutorials ever, holy shit it's pleasant to learn looking your videos bro, keep going !
@codeevolution18 ай бұрын
best teacher on youtube❤❤
@lamias77123 жыл бұрын
Thank you so much for your simplified explanation . Straight to the point.
@traveltheworld52412 жыл бұрын
Self learning but I understand easily ,this guy is awesome...
@quarduroy1 Жыл бұрын
Phenomenal explanation, thank you
@diamonddunyasi49452 жыл бұрын
Thx Bro I think you were descend from the sky 😀. We are waiting for more tutorials... Thank you
@dbvs0072 жыл бұрын
Awesome 👏
@murrayKorir3 жыл бұрын
well explained especially that part of where you can use 'Thing' instead of 'T' clears the mystery behind why is it always T,E or S.
@mohammedzaidkhan5687Ай бұрын
great video
@zxnnightstalker22894 жыл бұрын
Very clear explanation. My first clear understanding comes from you. Thanks a lot. ;)
@mariuspet892 жыл бұрын
Very nice video. You have a nice way of explaining programming concepts.
@anandchaudhary89523 жыл бұрын
Finally after spending 2 days reading the chapter and going over rigerious examples and still being clueless, I've understood generics. Love the channel name 😁
@mariuspet892 жыл бұрын
Yes, his chanel is very good!
@ArielLorusso Жыл бұрын
His channel is not generic
@Elan_Altair3 жыл бұрын
This was really helpful for my exams ,Tq broooooooooo
@mihirkohli48043 жыл бұрын
please do data structure love your content
@andersontiban5356 Жыл бұрын
so helpful thankyou
@jaaeamor79012 жыл бұрын
Thanks for making this tutorial. Appreciate it 👍
@chamindilhara57652 жыл бұрын
thanks for teach us
@kaushalprasadyadav92422 жыл бұрын
Great work bro👍
@Ethhix3 жыл бұрын
Thank you for making this video, it was very helpful and informative! I appreciate it.
@quanyufeng5793 жыл бұрын
Wonderful!!
@hawzhin0102 жыл бұрын
well done ❤❤
@hardcoded63253 жыл бұрын
very good, the best explanetion in the word!!! (i'm from Brazil)
@DuygamingBlogspot3 ай бұрын
I really understand what is arraylist😊
@andreajeanbatchelor51422 жыл бұрын
Great examples!
@kedarsambhus36233 жыл бұрын
Amazing! Easy to understand explanation to generics. Thanks bro.
@Ege393 жыл бұрын
Nice
@miazhi_4 ай бұрын
good video
@yifansu84322 жыл бұрын
This video is sooooooo awsome.......
@ndthdproduction29003 жыл бұрын
That's so good for the basic bro ! Hope you do more a bout advanced like more complex generic methods. Hope you doing well bro
@walterwhite2418 Жыл бұрын
Great video thx for your effort !!
@abvy253 жыл бұрын
Best explanation...
@darianchan46493 жыл бұрын
very nice tutorial bro keep em coming !
@wolanus4 жыл бұрын
Thanks for the tutorial, Bro.
@comrade107 Жыл бұрын
You are awesome! Thanks for all the help!!
@almanduku90433 жыл бұрын
Very useful lesson , thank you sir :)))
@chromeshock3774 Жыл бұрын
Dam, these videos are gold! So helpful in my bootcamp.
@ozbayhilmi11 ай бұрын
Thank you for this video.
@GenjaOrigins3 жыл бұрын
I was rejected in interview cause i didnt know what is generics and i saw that in their code xd, i saw many in a generic method. Thx
@miuwai62112 жыл бұрын
Very clear explanation. Thank you Bro. :)
@EdgarLopez-dq6zv Жыл бұрын
I really like your videos. You explain complex concepts appears easy, thx man
@fitzsimmons711 ай бұрын
this was helpful, exploded my brain, thanks
@kemann38153 жыл бұрын
Wow. Magnificent
@Garrison862 жыл бұрын
Amazing! thanks for this awesome explanation, really appreciate your videos.
@dieseldust53153 жыл бұрын
Great Tutorial!
@keler502136 күн бұрын
great video!!!!
@aruldilip94303 жыл бұрын
I learnt lot of things so far from the above 83 videos
@d.4hveed3 жыл бұрын
Very good explanation!! Thank u
@Say2Cups7 ай бұрын
This the guy that taught me how to code fr
@calebkrauter402711 ай бұрын
Very helpful! Thank you.
@swankitydankity2973 жыл бұрын
Fantastic tutorial! Thank you so much :)
@mackymichel80523 жыл бұрын
Great.
@kyomuhendoprecious84142 жыл бұрын
Thanks alot
@alanwarthon Жыл бұрын
Nice, thanks
@mustapharaimilawal80533 жыл бұрын
Thanks a lot for this amazing tutorial.
@NatyTor2 жыл бұрын
ho mannnnnnn your video are so clearly and amazing!! love you bro! thanks for all!
@khazarkhalilov755 Жыл бұрын
Liked & Subscribed ! 😊
@dashunderscore74702 жыл бұрын
i am a fellow bro 😎, bro code plaese keep creating videos about java, there are very less content on youtube about java, everyone is posting videos about python , javascript but no one explaining java🥲 , thank you bro.