Inner Class Java Tutorial - Creating and Using Inner Classes

Inner Class Java Tutorial - Creating and Using Inner Classes

Coding with John

3 года назад

124,717 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@RajasthaniINAmerica
@RajasthaniINAmerica - 24.12.2023 08:39

Sound’s Weird but What is the use of inner class I never used it before ??

Ответить
@user-zb1rt3um6r
@user-zb1rt3um6r - 04.12.2023 11:32

This guy about to save my semeseter

Ответить
@zeppelinmexicano
@zeppelinmexicano - 04.12.2023 00:44

Q. What sort of problems are most easily solved using inner classes or method level classes?

Ответить
@KingSardius
@KingSardius - 23.11.2023 00:33

I learn something new with you every time I revisit familiar subjects. You are great!

Ответить
@ssentongohenryatanus4917
@ssentongohenryatanus4917 - 09.10.2023 08:09

Hello John!!! I am truly grateful the great work your doing.. Please help me with concerning serialization, deserialization and externalisation. Thank you

Ответить
@lilywinsor4591
@lilywinsor4591 - 04.10.2023 00:47

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!!

Ответить
@shresthvatsal927
@shresthvatsal927 - 01.10.2023 18:57

thank u very much !

Ответить
@jlwonders
@jlwonders - 29.08.2023 20:04

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
@fc6827 - 15.08.2023 22:50

Appreciate this explanation about static inner classes, for some reason I keep forgetting what makes it static. Great vid!

Ответить
@abulka
@abulka - 16.07.2023 04:44

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.

Ответить
@virajgawand7133
@virajgawand7133 - 21.06.2023 07:57

exactly 2 years later I'm watching this, watched last year for the first time actually :)

Ответить
@johndrowned7170
@johndrowned7170 - 13.06.2023 23:36

I love you John

Ответить
@dragosudrea6533
@dragosudrea6533 - 21.04.2023 00:53

>Has never seen this being used
>Still makes a video about it

Big hustler energy!

Ответить
@yuvaraj9740
@yuvaraj9740 - 12.04.2023 15:59

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! 🖤

Ответить
@dhrubajitbarman1533
@dhrubajitbarman1533 - 01.04.2023 13:27

That's the weirdest thing i tried today 😂😂😂

Ответить
@luckypatiala8298
@luckypatiala8298 - 23.03.2023 11:46

can anybody tell me whats the theme he is using for eclipse and how to download it!

Ответить
@chudchadanstud
@chudchadanstud - 26.02.2023 16:52

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.

Ответить
@Devivl
@Devivl - 22.12.2022 15:20

Great lesson, John! Thanks!

Ответить
@chnakaprasanna7248
@chnakaprasanna7248 - 03.12.2022 16:25

😍😍😍😍😍😍😍

Ответить
@IndellableWasTaken
@IndellableWasTaken - 30.11.2022 16:00

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.

Ответить
@DancingTeapot
@DancingTeapot - 22.11.2022 21:55

Am I just too drunk or is there a weird echo in the sound?

Ответить
@BradleyWeston92
@BradleyWeston92 - 08.11.2022 09:41

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

Ответить
@LeighHughesSenlis
@LeighHughesSenlis - 30.10.2022 14:11

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.

Ответить
@andrealencar8060
@andrealencar8060 - 22.10.2022 01:26

Nice tutorial

Ответить
@MTB_Bay_Area
@MTB_Bay_Area - 14.10.2022 00:31

Thank you

Ответить
@jamesdrinkard2751
@jamesdrinkard2751 - 12.10.2022 20:08

I've written a lot of different inner classes, but I still learned some things from the video. Kudos to you John!

Ответить
@trustDproc3ss
@trustDproc3ss - 09.10.2022 19:56

this kind of code is not good. i saw a lot of code in my current company. it not very maintainable .

Ответить
@deepsuryavanshi6256
@deepsuryavanshi6256 - 01.10.2022 13:03

Thank You very much john, ur teaching style is soooooo awesome I got the info which I was searching for . Hatss offff....
👍👍🙏

Ответить
@AndresGorostidi
@AndresGorostidi - 25.09.2022 19:09

¡Gracias!

Ответить
@AndresGorostidi
@AndresGorostidi - 25.09.2022 19:07

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!

Ответить
@AndresGorostidi
@AndresGorostidi - 25.09.2022 19:05

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?

Ответить
@stefans6557
@stefans6557 - 14.09.2022 00:07

Interesting, but could have a bit more depth, like the proper use of inner data classes in a service class, or whatever.

Ответить
@teaadvice4996
@teaadvice4996 - 28.08.2022 20:49

if john didn't exist i would be so lost

Ответить
@MzamoHerbza
@MzamoHerbza - 17.08.2022 15:22

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

Ответить
@fredericoamigo
@fredericoamigo - 13.08.2022 09:49

Dude, you’re amazing at explaining Java. Thank you so much for these vids!

Ответить
@MrMiltersen
@MrMiltersen - 22.07.2022 23:31

Hi John!

Love you videos!

Would you maybe consider making a few videos about Spring? :)

Kind regards!

Ответить
@vasifsultanov4308
@vasifsultanov4308 - 21.07.2022 17:32

Can you help me with name of color theme which you use in video

Ответить
@DaxterSnickers
@DaxterSnickers - 11.07.2022 13:00

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.

Ответить
@tristanmoller9498
@tristanmoller9498 - 04.07.2022 18:07

Inner classes make sense, when you want a class A to implement the iterator interface. To effectively do so, you'd need an iterator object. The way that item iterates over objects from class A totally depends on what class A is. You'd probably need to implement the iterator differently for another class B. Here, encapsulation provides a use case for inner classes.

Ответить
@anuragdeshpande657
@anuragdeshpande657 - 03.07.2022 12:46

Please do some on streams

Ответить
@mahe7524
@mahe7524 - 01.07.2022 02:37

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.

Ответить
@joshuamodiba853
@joshuamodiba853 - 19.06.2022 13:33

Ahh my daily bread 🍞

Ответить
@jasper5016
@jasper5016 - 13.06.2022 18:07

You are born to teach. Can you please cover design patterns specially SOLID if possible?

Ответить
@shariefyassin6419
@shariefyassin6419 - 09.06.2022 01:30

I like how simple you make things and explain them , very useful video 👍👍

Ответить
@johntravolta2655
@johntravolta2655 - 08.06.2022 19:11

Poland Computer Science student says thank you !!
The way you teach is absolutely awesome!

Ответить
@blehblah1
@blehblah1 - 16.05.2022 06:10

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.

Ответить
@hassankalantari4016
@hassankalantari4016 - 09.05.2022 20:52

That was just GREAT!
You didn`t waste my time!

Ответить