//----------------------- 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; } }
@TechnoSan09 Жыл бұрын
thank you so much love u bro forever subscriber
@Crispeaks9 ай бұрын
Single-handedly taught me Generics and helped me complete an assignment in 30 minutes. Epic!
@tomaszkarolak61793 жыл бұрын
The best tutorials, I've ever seen on YT, thx bro!!!
@angelcastineira25613 жыл бұрын
a lot of new stuff but really well explained, thanks!
@john81487 Жыл бұрын
I always go through one of these videos before starting my bootcamp lessons. It makes everything so much easier to get into.
@jojovstojo Жыл бұрын
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
@patrickjaposmack4573 Жыл бұрын
Excellent tutorial video about generic classes and methods!
@furki35563 жыл бұрын
you have really the best tutorials I have ever seen, thank you. greetings from germany
@faniliana3 жыл бұрын
This would be the best java tutorial videos out there. Thank you bro
@lamias77122 жыл бұрын
Thank you so much for your simplified explanation . Straight to the point.
@ravenguirao90819 ай бұрын
Thanks, I finally understand Generics, some code training/bootcamps explain it really complicated.. but with you i realized it's just that simple.
@chris07ism Жыл бұрын
Thanks again for another relatively simple concept explained in a brilliant way.
@Naanu_kartik3 жыл бұрын
concept cleared 🙌 Thanks Bro...and you have an unique way of explaining the things.
@kedea1593 жыл бұрын
Really the best tutorials on KZfaq, that I've seen, keep up the good work Bro!
@victoriagee10592 жыл бұрын
Your code is so clean. You really know what you are doing!!!!
@deeplife9654 Жыл бұрын
Let start a campaign to give bro best teacher on youtube award !!!!! ❤❤❤❤❤❤❤ .
@comrade1077 ай бұрын
You are awesome! Thanks for all the help!!
@user-yz9cp6fp4k Жыл бұрын
You are the best !!! Thanks for lessons in 2023
@larkinthesky4 ай бұрын
You, my dear Sir, are a legend. Thank you so much for all these incredibly useful instructional videos.
@kedarsambhus36233 жыл бұрын
Amazing! Easy to understand explanation to generics. Thanks bro.
@swankitydankity2973 жыл бұрын
Fantastic tutorial! Thank you so much :)
@atongpayatoyatu27603 жыл бұрын
what the hell so good java tutorial i ever saw in youtube. thank you very much!
@kishorekumar.v60937 ай бұрын
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 ...
@av26782 жыл бұрын
Wow! Generic is so damn useful. I wish i saw this video yesterday lol but still, better than never. Well explained too
@OnlyOneGedeon2 жыл бұрын
Thank you for this very helpful video
@wolanus3 жыл бұрын
Thanks for the tutorial, Bro.
@chamindilhara5765 Жыл бұрын
thanks for teach us
@walterwhite2418 Жыл бұрын
Great video thx for your effort !!
@quarduroy1 Жыл бұрын
Phenomenal explanation, thank you
@ozbayhilmi5 ай бұрын
Thank you for this video.
@nawfalnjm56993 жыл бұрын
man this video is full of great info , thank you so much !
@Ethhix3 жыл бұрын
Thank you for making this video, it was very helpful and informative! I appreciate it.
@jaaeamor7901 Жыл бұрын
Thanks for making this tutorial. Appreciate it 👍
@calebkrauter40275 ай бұрын
Very helpful! Thank you.
@Snowmanver22 жыл бұрын
best channel with best tutorials out there!
@mackymichel80522 жыл бұрын
Great.
@nasseranaoui3315 Жыл бұрын
That was a good tutorial , thanks :D
@kemann38152 жыл бұрын
Wow. Magnificent
@mustapharaimilawal80533 жыл бұрын
Thanks a lot for this amazing tutorial.
@ginasomara2673 жыл бұрын
most helpful generics video on the internet. hands down
@zxnnightstalker22893 жыл бұрын
Very clear explanation. My first clear understanding comes from you. Thanks a lot. ;)
@andersontiban5356 Жыл бұрын
so helpful thankyou
@dieseldust53152 жыл бұрын
Great Tutorial!
@alanwarthon Жыл бұрын
Nice, thanks
@Garrison862 жыл бұрын
Amazing! thanks for this awesome explanation, really appreciate your videos.
@sergeyb60713 жыл бұрын
wow that's a lot of stuff in one tutorial 🤯👍
@traveltheworld5241 Жыл бұрын
Self learning but I understand easily ,this guy is awesome...
@benderbg9 ай бұрын
Great explanation of an important topic. Thanks Bro!
@darianchan46493 жыл бұрын
very nice tutorial bro keep em coming !
@roxorsrule86042 жыл бұрын
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!
@jesseemana9598 Жыл бұрын
this channel is a gold mine
@dbvs0072 жыл бұрын
Awesome 👏
@karanbrar19343 жыл бұрын
That 1 dislike is from bro himself, just to keep himself humble... ;)
@alexreznitsky6338 Жыл бұрын
Thanks a lot!!! great explanation!
@v1krv2 жыл бұрын
Well explained
@hgatl3 жыл бұрын
Awesome explaining, thx bro!
@almanduku90433 жыл бұрын
Very useful lesson , thank you sir :)))
@EdgarLopez-dq6zv Жыл бұрын
I really like your videos. You explain complex concepts appears easy, thx man
@fitzsimmons75 ай бұрын
this was helpful, exploded my brain, thanks
@solutionbybrain9978 Жыл бұрын
You are so smart to simplify such big task in a simple ways Thank you bro! Of Eritrea 🇪🇷
@manyokdavidkuch20543 жыл бұрын
Very good explanation!! Thank u
@quanyufeng5792 жыл бұрын
Wonderful!!
@mariuspet89 Жыл бұрын
Very nice video. You have a nice way of explaining programming concepts.
@chromeshock3774 Жыл бұрын
Dam, these videos are gold! So helpful in my bootcamp.
@user-gc9ob4pb3w Жыл бұрын
finally I got it. Thank you, Bro!
@Remolhunter973 жыл бұрын
Best tutorials ever, holy shit it's pleasant to learn looking your videos bro, keep going !
@rokhafm9412 Жыл бұрын
Thank you bro! Very useful video
@andreajeanbatchelor51422 жыл бұрын
Great examples!
@NatyTor2 жыл бұрын
ho mannnnnnn your video are so clearly and amazing!! love you bro! thanks for all!
@tunghuynh85042 жыл бұрын
Thanks Bro, this help me to easily understand the basic concept of Generics in Java
Thx Bro I think you were descend from the sky 😀. We are waiting for more tutorials... Thank you
@mihirkohli48043 жыл бұрын
please do data structure love your content
@ndthdproduction29002 жыл бұрын
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
@anonimanonim12232 жыл бұрын
Great
@Elan_Altair2 жыл бұрын
This was really helpful for my exams ,Tq broooooooooo
@davidionesi92074 ай бұрын
Thank you, my Bro.
@Speak_The_Truth_337 ай бұрын
Thanks bro
@murrayKorir2 жыл бұрын
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.
@alimulmahfuztushar70013 жыл бұрын
Love your content.
@MrLoser-ks2xn Жыл бұрын
Thanks
@hardcoded63252 жыл бұрын
very good, the best explanetion in the word!!! (i'm from Brazil)
@kkspuder3 ай бұрын
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
@colinbrowne70533 жыл бұрын
This helped a lot thank you
@kaushalprasadyadav92422 жыл бұрын
Great work bro👍
@acemanftw3 жыл бұрын
instantly subbed after that intro :)
@BroCodez3 жыл бұрын
yassss! thanks aceman
@waleedharalkathiri18363 жыл бұрын
THE BEST EVER EXPLENATION OF GENERIC CLASS AND METHODS IN KZfaq HISTORY🤣