Java Anonymous Inner Classes Explained in 6 Minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 245

  • @achyuthraosathvick45
    @achyuthraosathvick45 10 หลายเดือนก่อน +15

    Interviewer: So what is an anonymous class in java?
    My brain: 2:21

    • @1ai_13x
      @1ai_13x 10 หลายเดือนก่อน +1

      hahahahahha good one

  • @19891214ful
    @19891214ful 3 ปีที่แล้ว +96

    I’ve been in the industry for 8+ years and sometimes I forget the basics. Thank you very much for the effort. You are a brilliant teacher. Respect ✊ ❤️

    • @Ella-gi3xb
      @Ella-gi3xb 4 หลายเดือนก่อน

      This is so validating haha

  • @jvsnyc
    @jvsnyc 3 ปีที่แล้ว +42

    Excellent. I can hardly think of anything to add that wouldn't make it too long. Some people might think "Who needs this crap anymore, we have lambdas now and they are even neater!"
    That is more than a little true, but here's a couple of restrictions on lambdas that don't apply to anonymous inner classes:
    Lambdas can only be used with Single Abstract Method interfaces, and can only override that single abstract method itself.
    An anonymous inner class, on the other hand can merrily override more than one method, or can do even more, tho it is a good idea not to get carried away. If there's too much in it, give that sucker a name.
    An anonymous inner class can implement any interface, not just Single Abstract Method ones, again, best not to get too carried away with this but the language won't stop you, and can also subclass any abstract or concrete class if there's a good reason to.
    So lambdas are great, but it would be premature to throw Anonymous Inner Classes out of your Java toolbox.

    • @CodingWithJohn
      @CodingWithJohn  3 ปีที่แล้ว +25

      Sounds like you know more than enough to be doing your own videos!

  • @lost_mallu
    @lost_mallu 3 ปีที่แล้ว +22

    That last "Grawlneenlnenleng" though😂

    • @luanb2108
      @luanb2108 10 วันที่ผ่านมา +1

      The fact that you spelled the exact same way as him got me lol

    • @CodingWithJohn
      @CodingWithJohn  10 วันที่ผ่านมา +1

      @luanb2108 That took some dedication

  • @felixro1006
    @felixro1006 10 หลายเดือนก่อน +2

    I'm going to write an exam about Java tomorow. John, you are saving me from letting it be a total desaster. Your explanation style is wonderful and you have exactly the right amount of humor in your videos. Your explanations and your English is very good understandable, even for a non-native English speaker on level B2. I honestly watch your videos as they are the best to understand, motivating, not too long but have everything important in it. You are doing a great job! Thank you and please continue like that!

  • @a2406
    @a2406 3 ปีที่แล้ว +34

    Your lessons are prompt, easy to understand, and generally fun to watch. A perfect way for me to brush up my rusty Java skills. Keep up the good word!

  • @jeffreyzeiberg4033
    @jeffreyzeiberg4033 ปีที่แล้ว +1

    Thanks!

  • @cmasenv3818
    @cmasenv3818 2 ปีที่แล้ว +12

    How does this guy not have more subscribers? Straightforward, to the point explanations that are well presented, and importantly no needless filler. Just awesome, you've earned my like, sub and comment!

  • @akashsonar6332
    @akashsonar6332 10 หลายเดือนก่อน +1

    These concepts are deep and no one teaches this indepth. Glad that I found this channel.

  • @KingSardius
    @KingSardius ปีที่แล้ว +1

    You are one of the best teachers I have ever seen, you and another that I won't mention here out of respect. But I think that you videos are the clearest of any teacher that I have seen online, period. I love your videos.

  • @corygallego8148
    @corygallego8148 10 หลายเดือนก่อน +1

    You are really the best!!! Every single time I need help I come to see your videos and even if I m not 100% good with english you make it so easy to understand!! THANK YOU!

  • @SiirCartierr
    @SiirCartierr 2 ปีที่แล้ว +9

    Ur carrying my uni courses so hard, thanks a lot man!

  • @HugoBernardo-m4l
    @HugoBernardo-m4l 4 หลายเดือนก่อน +1

    SIMPLICITY; simply great, regardless the not so simple content!

  • @drakendragon5296
    @drakendragon5296 หลายเดือนก่อน +1

    Super clear and understandable, thank you!

  • @Nathan00at78Uuiu
    @Nathan00at78Uuiu ปีที่แล้ว +1

    This helped me understand some code at work. There is an anonymous class that is implementing an abstract class that takes in a Generic Type which implements an Interface with a Generic Type. So public abstract class PortalAsyncCallback implements AsyncCallback and the anonymous class is actually only overriding the methods from the AsyncCallback Interface.

  • @cavendar24
    @cavendar24 ปีที่แล้ว +1

    It's amazing how I can see and even use something fairly often and still gain insight here about what I'm really doing. Thanks.

  • @spiritualquest6092
    @spiritualquest6092 ปีที่แล้ว +1

    Best explanation ever, after going through many tutorials of Innerclass concept. You are one of the Best Teachers.

  • @suryateja1996
    @suryateja1996 ปีที่แล้ว +1

    Thanks John. This is really useful. I loved that bigfoot sound lol,. It's so accurate

  • @xhappybunnyx
    @xhappybunnyx 2 ปีที่แล้ว +1

    Legit just clicked on the vid and need to bet that the thumbnail's a suburban sasquatch reference
    edit: damn
    (also real talk I love these videos, they're a wonderful supplement to a free online course I'm doing. might check yours out later!)

  • @tresaidh3y90
    @tresaidh3y90 3 ปีที่แล้ว +7

    I spend about two hours every day with you John. We will land a developer job in 2022!

    • @dataslid
      @dataslid 2 ปีที่แล้ว

      Have u landed a job

    • @tresaidh3y90
      @tresaidh3y90 2 ปีที่แล้ว

      @@dataslid I have my first interview today!!!

    • @dataslid
      @dataslid 2 ปีที่แล้ว

      @@tresaidh3y90 I wish u luck🤞

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว +1

      Good luck, let us know how it goes!

    • @More.A-gf5rd
      @More.A-gf5rd 2 หลายเดือนก่อน

      ​@@tresaidh3y90hey ! You placed ?

  • @fcoGaz
    @fcoGaz ปีที่แล้ว +2

    The best vides of Java...Thanks a lot

  • @xetbytetechnology1445
    @xetbytetechnology1445 2 ปีที่แล้ว +1

    I have been traveling on 🌍 Earth with Java for 10 years just 5 miles, but after watching your video tutorial approx 6:26 minutes I have traveled with Java 24,887.64 miles which is exactly the circumference of the Earth. Now I am 🦋🦋🦋 flying with Java in ✈🛩🪐. A lot of thanks. I really appreciate.

  • @mustapharaimilawal8053
    @mustapharaimilawal8053 ปีที่แล้ว +1

    Thanks a lot for making this video, your explanation is super easy to follow, you are a very good..... great teacher. I was trying to use an anonymous class for multi-threading with the run method and boom!!!, it was your second example. Thanks a lot.

  • @Юлия-т7ц7и
    @Юлия-т7ц7и 2 ปีที่แล้ว +2

    can't thank you enough for your videos
    i am starting a new job as a junior java programmer in May. I had used lots of your videos to prepare for the inverview and am using them now to prepare for the job itself. thanks :)

  • @iIO_OIi
    @iIO_OIi ปีที่แล้ว +1

    OHhh, so those are classes, good to know.
    It's also nice to know there's a way to make a class that can only ever have one instance of itself, because I wanted that for something I want to do in the future, and will probably use it for many other things.

  • @sebastiancarvajal3855
    @sebastiancarvajal3855 ปีที่แล้ว +1

    Hey man, I just found your videos, I just want to say that I love you 🤣. You're a genius, I get to understand these complex topics easily in quick, short videos.

  • @johndrowned7170
    @johndrowned7170 ปีที่แล้ว +3

    I Totally agree with the guy that wrote Im not kidding whe I say you´re the best Java Teacher but to help the purpose of the channel im creating another comment

  • @emersontavera9362
    @emersontavera9362 ปีที่แล้ว +1

    I love java, I'm reading The Java complete reference 11-edition and doing some online course, I think I just found the java grial in your channel, good content, thanks man

  • @yass_h_z
    @yass_h_z 2 ปีที่แล้ว +1

    YOU ARE THE BEST U HAVE BEEN SAVING LIVES FOREVER

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว +2

      I had no idea anonymous inner classes could save lives!

    • @yass_h_z
      @yass_h_z 2 ปีที่แล้ว

      Hahahahaha i cannot believe that you replied to me thanks man i really appreciate the efforts you're making and the awesome explanations
      (Btw my exam is tomorrow hahaha)

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว +2

      Good luck, let us all know how it goes!

    • @yass_h_z
      @yass_h_z 2 ปีที่แล้ว

      @@CodingWithJohn yess for sureee

    • @yass_h_z
      @yass_h_z 2 ปีที่แล้ว

      @@CodingWithJohn it was really difficult , mostly about stream but i did what i could

  • @ЕвгенийСкорик-ь5ю
    @ЕвгенийСкорик-ь5ю ปีที่แล้ว +1

    The clearest way of providing information!
    Really a cool guy

  • @codewizard131
    @codewizard131 2 ปีที่แล้ว +1

    You are the best teacher I've ever seen

  • @anlerylmaz8415
    @anlerylmaz8415 2 ปีที่แล้ว +1

    Best Java teacher I've ever seen. And most sympatic one aswell

  • @Roman-qq9gx
    @Roman-qq9gx ปีที่แล้ว +1

    well made vid, thanks. “one-time-use class with an interface”. jesus, I love how much easier this is in JS. that is just a simple variable. strong OOP is jaded 😂

  • @igor9919
    @igor9919 10 หลายเดือนก่อน +1

    hi John, I've been loving your content so far, I wanted to give a suggestion if you don't mind! One of the things we wonder as we learn new concepts, which you make it very easy to understand is how we could/would use this in a real world situation, because obviously the examples used are simple (so we can understand), so perhaps it would be nice to add some "real world scenario" use case, just so we can have that extra "ahhh that makes sense" :D

  • @johncusack4730
    @johncusack4730 4 หลายเดือนก่อน +2

    Fantastic, you're the best !

  • @kushantsingh1563
    @kushantsingh1563 ปีที่แล้ว +1

    Hey John ,
    Whoever you are ,wherever you are from trust me you are a genius. To possess a knowledge is great and most of the humans can inherit it but the toughest part is to share and make other people learn in the most simplest way and thats what you actually do.
    I myself have been into coding for past 10 years but when it comes to explaining things to someone I always find it difficult to look for examples and to do it in the most efficient and effective manner.
    Anyways ,was here to brush up on few interview basics and subscribing your channel to keep myself updated and come back again.
    Thanks again . Cheers!

  • @cearobinson
    @cearobinson 3 ปีที่แล้ว +6

    Seriously cannot be stated enough: you produce the most easily understood, time considerate, and useful programming tutorials, period.
    From a 35 year old junior engineer: thank you ❤️.

  • @kuntaldutta2558
    @kuntaldutta2558 2 ปีที่แล้ว +1

    really really very very good work sir. The way you are teaching is very good.

  • @tomgu9430
    @tomgu9430 2 ปีที่แล้ว +1

    voice of big foot lol, best teacher ever!

  • @Ozla102
    @Ozla102 2 ปีที่แล้ว +1

    you are the best for learning JAVA. I am sure about it.

  • @AbdelhameedGamal-ki7th
    @AbdelhameedGamal-ki7th 10 หลายเดือนก่อน +1

    thanks a punch for your simple, direct and nice explanations

  • @הדרפדה-אל
    @הדרפדה-אל 2 ปีที่แล้ว +1

    You're the best teacher on TH-cam! Thank you!!

  • @fernandamaurer9461
    @fernandamaurer9461 9 หลายเดือนก่อน +1

    really clear, you are an excellent teacher

  • @milton_tom
    @milton_tom ปีที่แล้ว +1

    Everything you teach is clear and understandable.

  • @filiprank9870
    @filiprank9870 ปีที่แล้ว +2

    Thank you for your tutorials.

  • @dlvinhafeez9966
    @dlvinhafeez9966 2 ปีที่แล้ว +1

    you are the best java instructor

  • @nkfasil752
    @nkfasil752 2 ปีที่แล้ว +1

    Wow this video was so easy and fun! Loved the big foot noise, hehe!! Keep up the good work!!

  • @Skilur1983
    @Skilur1983 11 หลายเดือนก่อน +1

    Great explanation. Loved bigfoot noise

  • @Agammoravia
    @Agammoravia ปีที่แล้ว +1

    You're my Java only teacher!! =)

  • @LTZMSYAL
    @LTZMSYAL 2 ปีที่แล้ว +1

    John you are a great teacher! merci pour tes videos. We watch you from France

  • @simbarashemuzika2157
    @simbarashemuzika2157 3 ปีที่แล้ว +1

    John you are simply the best . Do you have any Springboot tutorials

  • @mauiuwelcome6847
    @mauiuwelcome6847 2 ปีที่แล้ว +1

    😅😅😅 Your bigfoot noising stuff was exhilarating. Love this kind of funny teaching method as it has proven to be very efficient. Thanx a lot!

  • @ShermukhammadKarimov
    @ShermukhammadKarimov 7 หลายเดือนก่อน +1

    thanks for the great explanation

  • @banujan.b2479
    @banujan.b2479 2 ปีที่แล้ว +2

    Sometime I confuse you with "programming with mosh". Big fan of both of you!

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว +3

      Mosh is awesome! Another bald programmer with glasses.

  • @rishabgoel4218
    @rishabgoel4218 3 หลายเดือนก่อน +1

    Great content John. Please create a course ( paid ) for advanced Java, Springboot etc. too. No one explains Java better.

  • @ralfiasz
    @ralfiasz 2 ปีที่แล้ว +1

    Brilliant tutoring.

  • @starilin8445
    @starilin8445 2 ปีที่แล้ว +1

    I wish you were teaching at my school, your tutorials are the best

  • @Tuxon24rus
    @Tuxon24rus 3 ปีที่แล้ว +1

    It's always worth to watch your videos till the very end! xD

  • @phoebe3518
    @phoebe3518 2 ปีที่แล้ว +1

    Thank you so much I actually understand it know

  • @jaydeepmalviay2582
    @jaydeepmalviay2582 ปีที่แล้ว +1

    Simply to the point...

  • @gregtomkins5938
    @gregtomkins5938 2 ปีที่แล้ว +2

    Great channel, super clear explanations, always clearly explaining something I didn’t quite understand before. Cheers

  • @jellyjollyjelly9513
    @jellyjollyjelly9513 ปีที่แล้ว +1

    best java teacher

  • @hihiirokane_gbf
    @hihiirokane_gbf 2 ปีที่แล้ว +1

    thank you so much for this video^ ^
    it helped me a lot

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 11 หลายเดือนก่อน +1

    Very good explanation! Thank you! 💛

  • @tharinduwijetunge
    @tharinduwijetunge 3 ปีที่แล้ว +2

    This is exactly what I was looking for. Thank you very much for your explanation, and nice Bigfoot btw

  • @Carlos-kv6hx
    @Carlos-kv6hx 2 ปีที่แล้ว +1

    Thanks John for this video. You explained it very clearly. Please continue with these.

  • @aidoka2000
    @aidoka2000 2 ปีที่แล้ว +1

    Learned something new form another awesome tutorial by John :)

  • @nielltalwar1574
    @nielltalwar1574 3 ปีที่แล้ว +1

    you are helping the java learner community a lot john. keep up the good work

  • @ahmedbishree9429
    @ahmedbishree9429 3 ปีที่แล้ว +1

    LoL really appreciate the creative tutorials that you made, every time that I see your smile can't hold myself smiling too, I wish that I had a tutor like you in every subject in my learning journey big thanks and hugs to you

  • @JonasKeil
    @JonasKeil 2 ปีที่แล้ว +2

    Another great tutorial, thank you very much John!

  • @favorohanwe9575
    @favorohanwe9575 ปีที่แล้ว +1

    this was so good, thank you!

  • @aquarius7600
    @aquarius7600 3 ปีที่แล้ว +4

    Amazing work! You explained incredibly this topic that was bugging me

  • @rajattiwari8852
    @rajattiwari8852 3 ปีที่แล้ว +1

    Came across your youtube channel. I'm sorted for brushing up. Great videos

  • @janvipatel7022
    @janvipatel7022 2 หลายเดือนก่อน

    Loved the immitation of Bigfoot, laughing so hard

  • @anjan5545
    @anjan5545 2 ปีที่แล้ว +1

    Awesome..Please explain Supplier,Consumer,Predicate,Function etc..Many thanks for making things easy to learn.

  • @juliaineslopez4856
    @juliaineslopez4856 2 ปีที่แล้ว +1

    You are THE BEST. Never stop making videos!! I have a question. Can we include fields in an anonymous class? I read we cant because we can't include a statement in a statement but i'm not conviced!

  • @2k7Bertram
    @2k7Bertram 2 ปีที่แล้ว

    That bigfoot statement had me like "Wait...what??"

  • @liliabekuzinaensosense8987
    @liliabekuzinaensosense8987 2 ปีที่แล้ว +1

    John, you are such a talented teacher! 💫

  • @arshitrastogi2036
    @arshitrastogi2036 3 ปีที่แล้ว +1

    Thanks for explaining it in a clear and concise manner. I am definitely subscribing your channel 👍

  • @burgerbob7324
    @burgerbob7324 2 ปีที่แล้ว +1

    Awesome video as always. Thanks John!

  • @johntravolta2655
    @johntravolta2655 2 ปีที่แล้ว +1

    Yep, still the best explanation I could have came across

  • @Valer0n07
    @Valer0n07 2 ปีที่แล้ว +1

    Thanks for a great job. Your tutorials and explanations are the best in the whole universe:)))

  • @LukasJozefaciuk
    @LukasJozefaciuk ปีที่แล้ว +1

    can you also explain the diffrence between Anonymous Inner Class and Singleton? Thanks in advance. I can only confirm a perfect teacher so i am enjoyful enjoy each session. Thanks

  • @louman4322
    @louman4322 2 ปีที่แล้ว

    You're awesome man. Thank you.

  • @andresencolombia
    @andresencolombia 2 ปีที่แล้ว +1

    You are simply awesome. Thank you so much. You demystify Java programming.

  • @phoboslabsreviews
    @phoboslabsreviews 2 ปีที่แล้ว +1

    Very clear and simple explanation.

  • @OgedeiKhanOKOK
    @OgedeiKhanOKOK 2 ปีที่แล้ว

    How to decide when to use Anonymous Inner Class vs Singleton Design Pattern ?
    Is size of the class the only factor or something else too.

  • @manojr5257
    @manojr5257 3 ปีที่แล้ว +2

    Confiremed! John is a friend of Big Foot!

  • @siegfried-sw
    @siegfried-sw 2 ปีที่แล้ว +1

    Perfect articulation. I like it!

  • @ShubhamChakrabortyBA--
    @ShubhamChakrabortyBA-- 3 ปีที่แล้ว +3

    Sir, please make a video on Singleton classes.

  • @abdulraqebal-sarori6390
    @abdulraqebal-sarori6390 2 ปีที่แล้ว +1

    Your videos are amazing and the best thing that you explain very important things in the easiest and shortest ways. Would you please make some videos a bout Spring framework (web) thank you 😊

  • @martincaceres6209
    @martincaceres6209 ปีที่แล้ว

    Really usefull, thanks! 😃

  • @naturalrunning
    @naturalrunning 2 ปีที่แล้ว +1

    Thank you very much for your work! It's both - learning and having fun at the same time :-)

  • @cheribgh275
    @cheribgh275 2 ปีที่แล้ว +1

    I couldn't imagine myself laughing while learning any subjects of Java🤣🤣🤣, you are funny John!!! Thanks.

  • @Amuzeraa
    @Amuzeraa 2 ปีที่แล้ว

    I liked the last part you made me lol 😂😂

  • @nafishy
    @nafishy 3 ปีที่แล้ว +1

    You're a blessing! 😭❤️

  • @tahiriqbal8543
    @tahiriqbal8543 2 ปีที่แล้ว

    woo explaination is exquisite

  • @robertovillanueva7077
    @robertovillanueva7077 2 ปีที่แล้ว +1

    Your videos are great! Thank you 😀

  • @user-do8mv9ow6d
    @user-do8mv9ow6d 3 หลายเดือนก่อน

    Thank you sir ...❤

  • @saikrishnapechetti8382
    @saikrishnapechetti8382 หลายเดือนก่อน

    nice explanation ❤