Watching this again I just realized I made a mistake with the editing in part of the intro, where I had my face in the corner and a blank rest of the screen. Oh well, hope you all can forgive such a grievous mistake >_>
@bendustin7609 Жыл бұрын
I never noticed!
@samuvisser2 жыл бұрын
Have been programming in java for years but somehow im hooked on all ur videos lol. Think its learning how to explain concepts in an easy way, ur so darn good at that. Also, had no idea you could create classes in a method! I keep learning
@19891214ful2 жыл бұрын
Same here dude! 🙌
@adipurnomo56832 жыл бұрын
Cool bro
@johntravolta26552 жыл бұрын
Poland Computer Science student says thank you !! The way you teach is absolutely awesome!
@KingSardius11 ай бұрын
I learn something new with you every time I revisit familiar subjects. You are great!
@jamesdrinkard27512 жыл бұрын
I've written a lot of different inner classes, but I still learned some things from the video. Kudos to you John!
@aprendeguitarraclasica2 жыл бұрын
You just made me interstand this concept after days of frustration. Thanks a lot!
@vikastiwari12972 жыл бұрын
You explain things by telling whats the problem or need of the topic that you're going to explain by giving a example case, It helps so much when i know where can be the concept that i am learning be used instead just watching plain theory tutorials which don't tell the cases where it can be used or whats the problem that may arise if we do things other way.
@dilln21583 жыл бұрын
This mans gonna get me through university
@CharlesWhitford3 ай бұрын
Spent the _whole_ day yesterday reading a book by C. Horstmann, trying to understand the syntax of outer/inner class, trying to understand how the _"this"_ keyword figures into this whole thing, and by the end of the day, I was more confused than I was at the start. I watched this video today and just 8 minutes into it, I understood nearly everything.
@jgabrielmiranda5 ай бұрын
I've had already read the documentation and understood how ir works but decided to see a video about it, because I was fatigue. And have to admit, your content is amazing. You explained this very fast and well. Congrats! Just sub to the channel. It'll help a lot for sure. Tks for the video.
@jlwonders Жыл бұрын
The best tutorial. I'm so glad to stumble upon this video. Concise. discusses the key important points of inner classes and examples. Very easy to understand how you speak. Well done.
@fc6827 Жыл бұрын
Appreciate this explanation about static inner classes, for some reason I keep forgetting what makes it static. Great vid!
@virajgawand7133 Жыл бұрын
exactly 2 years later I'm watching this, watched last year for the first time actually :)
@Theinatoriinator2 жыл бұрын
We use theese to program our frc robot, we have a constants class then inside od the constants class there are inner classes for each subsystem. It its really helpful when you want to keep everything divided and prevent yourself from mixing things up.
@faheemsyed94812 жыл бұрын
John your style of teaching is simply fabulous. you can make learn a person easily. thanks John.
@qwerrewq73885 ай бұрын
This Video just saved me in my Exam, thank you for the great Video
@stephenweber332 жыл бұрын
I was waiting until I found a case of inner class before I watched this video. Since you do a great job of instantiation. I found it looking at some example code for the ITERATOR DESIGN PATTERN.
@Enanram2 жыл бұрын
I've recently learned how to use an anonymous inner class to instantiate something like a HashMap and put values straight away. It would be good to learn more about anonymous inner classes and their uses.
@DaxterSnickers2 жыл бұрын
So innerclass are just normal classes in different locations, which you can access with Outername.Innername or inside the method when you create an object there. Got it. Thank you, this really blew my mind.
@OgedeiKhanOKOK2 жыл бұрын
Best thing I have learned from this channel is to never be lazy when typing names of stuff 🤣
@felixmorin46112 жыл бұрын
I think i just found the way to solove my problem i have with my code after 10 hs of searching, thank you!
@JonasKeil2 жыл бұрын
This tutorial is great John!!!
@jvsnyc3 жыл бұрын
This is great, and is also a great pre-req for an Anonymous Inner Class video you haven't made yet. Between lambdas and default methods in interfaces having been added to Java these days, you don't need anonymous inner classes anywhere near as often as you used to, but sometimes you do, and in older code they were used all over the places, not having those new facilities available yet before Java 8, so if you work with older code sometimes.... While there are a lot of weird little rules to remember about different kinds of inner classes in Java, that can sometimes get a little tricky, this is a fantastic introduction to the topic. Last detail, some people insist on always referring to the static kind as "nested" and the member kind as "inner", to try to keep things clear. I am often going to those sorts of people for help, so I try to stick to that.
@CodingWithJohn3 жыл бұрын
That's great info, thanks!
@kaledbrahmi34423 жыл бұрын
Could you do a video about packages in Java? Btw, good explanation, I was struggling to understand inner classes but now is all clear. Thank you
@_Anna_Nass_2 жыл бұрын
Leaving a comment for the KZbin algorithm because you’re super helpful 😁
@fredericoamigo2 жыл бұрын
Dude, you’re amazing at explaining Java. Thank you so much for these vids!
@shariefyassin64192 жыл бұрын
I like how simple you make things and explain them , very useful video 👍👍
@dragosudrea6533 Жыл бұрын
>Has never seen this being used >Still makes a video about it Big hustler energy!
@vladimirguevara38133 жыл бұрын
Hi John! I'm really thankful to you for all of your videos you really explain very well you make Java looks easy :) so I wanna ask you a video explaining design patterns of course when you can do it.
@HeisenbergHK2 жыл бұрын
That was just GREAT! You didn`t waste my time!
@dilln21583 жыл бұрын
You should do a java data structures series
@coding84532 жыл бұрын
Thanks so much ❤️, now I got what was Map.Entry
@MzamoHerbza2 жыл бұрын
short and straight to the point, I alwyz run away from nested classes. I find them clamssy & difficulty, lol, but from the video, am hooked and eager to use them. Not that difficult... lol
@ΧρηστοςΜελκιδης10 ай бұрын
This guy about to save my semeseter
@redcrafterlppa3032 жыл бұрын
Node in LinkedList and Pair in Map are great examples for local inner classes
@PieMongo3 жыл бұрын
Hey you did it! Thank you so much!
@CodingWithJohn3 жыл бұрын
Hope it helps, thanks for watching!
@PieMongo3 жыл бұрын
@@CodingWithJohn it sure does, keep up the good work!
@Sollace2 жыл бұрын
3:37 Oh wow, you learn something new every day XD
@2Blu25 ай бұрын
Thank you soo much, u made this so easy omgggg!!
@deepsuryavanshi62562 жыл бұрын
Thank You very much john, ur teaching style is soooooo awesome I got the info which I was searching for . Hatss offff.... 👍👍🙏
@ssentongohenryatanus4917 Жыл бұрын
Hello John!!! I am truly grateful the great work your doing.. Please help me with concerning serialization, deserialization and externalisation. Thank you
@Devivl Жыл бұрын
Great lesson, John! Thanks!
@TheIronWorkshop3 жыл бұрын
Thanks john, you are a life saver!
@IndellableHatesHandles Жыл бұрын
Nested classes are very useful to avoid namespace pollution. Being able to define a static class called "Loader" is a lot less confusing than having a separate class for each thing that needs to be loaded. Instead of your IDE trying to suggest a bunch of loaders all the time.
@bww7052 жыл бұрын
Amazing thanks, you videos are the best!
@MrMiltersen2 жыл бұрын
Hi John! Love you videos! Would you maybe consider making a few videos about Spring? :) Kind regards!
@prannoyroy53122 жыл бұрын
John, can you give a real life example where an inner class would only make sense to be inside a outer class to help us understand the scenarios?
@RogerHolden2 жыл бұрын
They work well for action listeners...
@haltsmaul.2 жыл бұрын
Builders
@jasper50162 жыл бұрын
You are born to teach. Can you please cover design patterns specially SOLID if possible?
@DiverseSituation2 жыл бұрын
this was so clear! thanks Johnny, from Noga and Elai
@srikanthchitturi72832 жыл бұрын
Thanks, I am a big fan of you!! Can you give some real time examples for better understanding..
@johncusack4730Ай бұрын
You're the best !
@blehblah12 жыл бұрын
CS student here, we recently learned about linked lists and I'm assuming one of the best ways to implement a node class for a linked list is to use inner classes right? since we only use the node class inside the linked list.
@andrealencar80602 жыл бұрын
Nice tutorial
@Youtuber-2024-lambda2 жыл бұрын
This is always a pleasure to Watch your vidéos courses, thank you very much John for all your java code passion !
@punitgupta71752 жыл бұрын
Can you please tell me what is the Usecases, I mean when we should use innerclass?
@HeyzonDub6 ай бұрын
Thank you so much ❤
@wristdisabledwriter28933 жыл бұрын
I want an example of when it’s more useful to do the inner class than a extended class
@CodingWithJohn3 жыл бұрын
Broadly, I mostly use them when the inner class I'm making should never be used in any other context than that specific outer class, and you don't want anyone using it by mistake. There's one circumstance where I use them often at work - it's a bit of an advanced situation for Java beginners so I didn't talk through it in the video, but I can describe it here. The applications we build at my job are web services, and we also often make calls out to other web services to gather more information we need. The structure of the response we receive from those other services is designed by that other team, and we don't have any control over it. But we need to take their response body and map it to a Java object so we can work with it, so we need to represent that response type on our application with a class we make. Their response body might look something like this: { errors: [ { clientErrorCode: "12345", clientErrorDescription: "You sent something bad" } ] } The "errors" inside that errors list should be their own class, and have a clientErrorCode and clientErrorDescription field, probably with getters and setters. But that class only makes sense in the context of this client's response. Sure, it's possible that right now it might fit in with some other class that has a code and description, but I wouldn't want to couple it with any other functionality in my code that doesn't relate to processing a response from this client. So if this client changes the structure of the response I just have to change this class, and no other code is affected. If I didn't make it an inner class, some other developer might find the class I make called "Error" and use it for something else that it shouldn't be used for, since it only makes sense here.
@wristdisabledwriter28933 жыл бұрын
@@CodingWithJohn thank you. That makes a lot of sense
@francksgenlecroyant2 жыл бұрын
Thank you, i am learning a lot from you John
@alfredomenezes88142 жыл бұрын
@@CodingWithJohn Perfect example! I was struggling to grasp some real use cases for inner classes, thank you very much
@anuraggdeshpande2862 жыл бұрын
Please do some on streams
@adams27362 жыл бұрын
One thing missing in this video, explaining why would anyone use inner classes.
@BekTesfa2 жыл бұрын
Can you talk about the builder pattern while you are on this topic? If I recall correctly inner class is used to build an object of a class using the builder pattern. You thoughts?
@MTB_Bay_Area2 жыл бұрын
Thank you
@johndrowned7170 Жыл бұрын
I love you John
@CodingWithJohn Жыл бұрын
@AndresGorostidi2 жыл бұрын
John, although it seems you are using eclipse (as I do) for your IDE; I bserved that you did not wrote System.out.println when code, instead it seems you type a shorcut (as sysout) and the IDE expand it to the correct syntaxt System.out.println command. Is that correct ? What pluggin or utility are you using for that ? It would be great if you do a video with those kind of tricks to get the most of your IDE!
@CodingWithJohn2 жыл бұрын
No plug-in required! It's built into Eclipse. You can just type "sysout" then Ctrl+Enter to autocomplete. I also have a full video of Eclipse shortcuts that might be just what you're looking for! kzbin.info/www/bejne/gnqqnHx9mdJ7f6s
@pabloraindogarcia81072 жыл бұрын
Could i ask for a video about composition??
@mykolazhabko32283 жыл бұрын
Thanks for tutorial! Simple and clear! Do you have a video explaining interfaces?? How can I use them in game development??
@CodingWithJohn3 жыл бұрын
Thanks for watching! I don't have a specific one yet, though the video on abstract classes touches on interfaces a bit. Basically an interface can be thought of as a contract; if you have a class that "implements" an interface, that is a guarantee that the class will have certain methods that the interface specifies you have to implement. Hard to give a specific example for game development, since it's very broad and depends on what you're trying to do in your code. But as a general example, maybe you have many different classes in your game that represent things that can make noise. Character, NPC, Enemy, Animal, Item, etc. They might not be related through normal Java inheritance. You can perhaps have some interface like MakesNoise, that specifies that each class that implements the interface has to implement a makeNoise() method. Then each of those classes can implement that interface, then just implement their own version of makeNoise(). Then anywhere in the code you know that anything that implements that interface is guaranteed to have that method available.
@mykolazhabko32283 жыл бұрын
@@CodingWithJohn Thank you a lot for replying me. I am developing kind of space shooter like "Space Invaders" with JavaFX for the Univercity course. Using one interface as a storage for constants like GAME_WIDTH. Now I want to use interfaces bit wider. Your explanation is clear to me. Thanks one more time.
@abulka Жыл бұрын
Wouldn't the best use case for inner classes be to make them private and instantiated only by the class within which they reside? Kind of like a local utility class for the class.
@AndresGorostidi2 жыл бұрын
¡Gracias!
@larryd95772 жыл бұрын
Inner classes are great for private data classes when you are pre java14
@Shva927 Жыл бұрын
thank u very much !
@squ1shshr00m Жыл бұрын
Off topic, but there appears to be something wrong with the subtitles/CC for this video, and I wanted to point it out! There's only an auto-generated Vietnamese option, and when translating the Vietnamese subtitles to English, it's completed unrelated to the video/what's actually being said. No idea what happened there, but I wanted to say something because it doesn't appear anybody else has!!
@agent54202 жыл бұрын
Can you please do GUI in java tutorial
@MsRebeca43 ай бұрын
It doesn't matter that the static definition for a class is that it cannot instantiate objects because we saw that it can. What is the true definition of a static class?
@yuvaraj9740 Жыл бұрын
Unfortunately watched it in 1.25 and all i understood is Outerclass, innerclass, so innerclass outerclass interclass. LOL JK. I understood it perfectly bro thank you! 🖤
@RajasthaniINAmerica10 ай бұрын
Sound’s Weird but What is the use of inner class I never used it before ??
@smrtfasizmu61612 жыл бұрын
If I am running my program from a Terminal these nested classé are the only way my code works. If I put classes in different files compiler can't find them, even though If I run that exact same code in an IDE it works. Yes, I am a beginner.
@vladimirkraus14387 ай бұрын
I think that inner classes are used mostly as private or protected so thay can be instantiated within the code of the outer class. Using the inner classes outside of the code of the outer class is totally weird.
@vasifsultanov43082 жыл бұрын
Can you help me with name of color theme which you use in video
@AndresGorostidi2 жыл бұрын
Thks for your videos, John, they are very useful. One thing I did not understand about inner classes.. Can you please clarify if when we are using System.out.println we are using a inner class and how is this defined ? It always confused me the way we did the print out on java, instead calling a simple method of a system class, it seems we are using a kind on inner class. Is that correct?
@pixlent11 ай бұрын
(I know I'm a year late, but better late than never) System.out simply returns a PrintStream which is another class / object. This method then has the println method. This is very similar to how the builder pattern works
@chudchadanstud Жыл бұрын
Is it even good practice to instantiate an inner class outside the outer class? I thought the whole purpose of the Inner class was for it to be used inside the Outer class.
@Livinsomehow Жыл бұрын
can anybody tell me whats the theme he is using for eclipse and how to download it!
@TheAnonymmynona2 жыл бұрын
This Video explains how to use inner classes well, but what problem do they solve ? When should I use them ?
@durgaprasadsurada46432 жыл бұрын
Where and why we use inner class
@tsalVlog2 жыл бұрын
Can you import a static inner class? I'm asking because I came into Java from Kotlin, and am still learning some of the 8-11-isms.
@leetaeryeo52692 жыл бұрын
I know this is months late, but I am curious. Can you return a method local internal class object from its local method scope? I’m thinking as like a really weird (and honestly not well designed) object factory method?
@LeighHughesSenlis2 жыл бұрын
I think the vast majority of your explanations are very good indeed, but not in this case. What needs to be explained first here is not how you create these inner classes, nor what different kinds there are, but what the point of them is. If you need to do something, why not just write another method? Why create an inner class, then write the method you need inside that? Please, explain the "why" first.
@CharlesWhitford2 ай бұрын
I think he alluded to the "why" towards the very end of the video -- he mentioned inner classes are not normal and are only used in large programmes, not in simple programmes. I understand your point about why he doesn't go into depth about the "why", but it's probably difficult to answer that question without giving an actual example of a long programme which has an inner class within an outer class. You can't do that in a 9-minute video.
@kcseanbrixd.calinao6700Ай бұрын
I think the purpose of learning inner classes is so you can better understand how an anonymous class work.
@Gianzero2 жыл бұрын
Good evening, may I ask what code editor do you use? Thanks
@CodingWithJohn2 жыл бұрын
Sure! In this video I'm using Eclipse, but in more recent videos (and in my day to day coding) I use IntelliJ.
@Gianzero2 жыл бұрын
@@CodingWithJohn Thank you so much!
@joshuamodiba8532 жыл бұрын
Ahh my daily bread 🍞
@stefans65572 жыл бұрын
Interesting, but could have a bit more depth, like the proper use of inner data classes in a service class, or whatever.
@maramhasri1632 жыл бұрын
Hi Mr.jhon thank you for this video but i want to ask you to talk leisurely if you can 🌝
@mahe75242 жыл бұрын
The video was great, thank you :-) May God bless you. 1) I know that if you compile the outside class it will be ==> OuterClass.class and OuterClass$InnerClass.class 2) When you want to run it from the command line, do you have to put it in a jar file first? What does this jar file have to look like "inside" so that the entry point is set up correctly? 3) Lastly...how do you run this from the command line and JShell with these scenarios: a)with arguments, without arguments, and b)if using Eclipse...with arguments(Run Configurations set up), without arguments(Run Configurations turned off/cleared out). I've been having trouble with turning "off" Run Configurations lately. After some research I had some trouble understanding this in stackoverflow, sorry. Thanks for reading.
@DarkOceanShark2 жыл бұрын
Hey, is anyone aware of the Eclipse theme that's being used in this tutorial? Thanks in advance :)
@sureshmanne72452 жыл бұрын
Did I miss the part of telling why to use Inner classes ?
@teaadvice49962 жыл бұрын
if john didn't exist i would be so lost
@zeppelinmexicano10 ай бұрын
Q. What sort of problems are most easily solved using inner classes or method level classes?
@shubhamchouksey99045 ай бұрын
@CodingWithJohn You mentioned about all types of inner classes. You forgot about Anonymous inner class. Maybe you don't want to cover it here. Thank you
@study-me1oe2 жыл бұрын
I have a doubt which most of them don't recognise whether such thing is present or not. I know about all the types of Inner classes, came here just for that one doubt which is... While creating the NON-STATIC Inner object using the Outer object as below Outer.Inner inner=outer.new Inner(); As we know that the Inner class is non-static, and in order to access the Inner class's constructor, we are using the Outer class object, but how come we are using the Outer class name for accessing Inner class name( Outer.Inner inner ) as in above which should not be possible!!(as the class is non-static, which must be accessed only through the Outer class object) so we have to use the object of the Outer class to access the Inner class object like ( outer.Inner inner= outer.new Inner(); ) which should be the correct answer but is wrong!!? Please anyone answer this.
@study-me1oe2 жыл бұрын
above question in simple terms.... We are accessing outer non static data member( InnerClass ) inside static method( main method)directly . How is it possible? ***Outer.Inner inner*** = outer.new Inner();
@mateenmehmood56752 жыл бұрын
Nice. but you just explained how to create inner classes but not explained why we created it?
@BradleyWeston92 Жыл бұрын
Great video but didn’t answer some stuff I was looking for, I ended up searching for “Java inner class” after seeing it used in the AWS SDK thinking how is “this” context shared because I couldn’t see where it was being set but could see it being used. So if you’re here for the same reason, after another search I can confirm to access OutterClass’s “this” from a method in InnerClass you’d write “OutterClass.this” same would apply for LocalInnerClass. Also the inner class cannot be static for this to work. A good time you might use this is when creating result objects that need reference to an underlying backend declared in the outter class
@prameenasenthil5262 жыл бұрын
need jsp servlet videos
@Arshad_mirza00719 күн бұрын
Brother you have skipped the anonymous inner class😢
@feynthefallen7 ай бұрын
Never used a non static inner class in all my more than 20 years of java...