Java inner classes 👩‍🏫

preview_player
Показать описание
java inner class

#java #inner #classes

public class Main {

public static void main(String[] args) {

/* inner class = A class inside of another class.
useful if a class should be limited in scope.
usually private, but not necessary
helps group classes that belong together
extremely useful for listeners for specific events
precursor for anonymous inner classes
*/
Outside out = new Outside();
in.Greeting();
}
//**********************************************************
public class Outside {

String x = "Hello ";

public class Inside{

String y = "World!";

public void Greeting()
{
}
}
}
Рекомендации по теме
Комментарии
Автор

public class Main {

public static void main(String[] args) {

/* inner class = A class inside of another class.
if a class should be limited in scope.
private, but not necessary
group classes that belong together
useful for listeners for specific events
for anonymous inner classes
*/
Outside out = new Outside();
Outside.Inside in = out.new Inside();
in.Greeting();
}

public class Outside {

String x = "Hello ";

public class Inside{

String y = "World!";

public void Greeting()
{
System.out.println(x+y);
}
}
}

BroCodez
Автор

You have amazing ability to simplify programing concepts. Please keep creating programing videos for this channel. It really helps lot of us. Many thanks.

syednizam
Автор

You guys rock! I'd love to see one about servers and clients talking to each other & running threads, like for a multiplayer game - but maybe that's in the one on serialization? My son is a pro dev and he's building a jrpg for fun, but he's super busy. I'm trying to work on it with him, but I've only been studying (mostly java) part-time for about 3 yrs. He's got the game running - server, client, kryo serialization, awt, swing, jframes etc. A couple of screens exist, and characters can move and interact, but there is so much more to build. I really want to add to it, but I'm a bit lost in code. Your videos really help! Thanks so much!!!! Every time I watch one, I hit the like button and leave a comment. And I've subscribed. So, here's to your algorithms!

pesterlig
Автор

This is a wonderful way to teach an inner class I like it.

HappyManRwaka
Автор

This and a few other videos are missing in the 12 hour video. Or have I just slept there? :-D Anyway this is brilliant, thanks a lot!!!

trailblazer
Автор

these tutorials are awesome! Only thing that could improve is the amount :)

hytalefanboi
Автор

i don't have any comment because you are my best java teacher but i'm here for support you and let you know that there is someone who waiting for your video :D

jfruit
Автор

Great job! You explain well, more people should see your tutorials!!!

yahelbraun
Автор

Wait this wasn't illegal?! (JK love your vids) :D

tacticalcacti
Автор

Is there a way to see inner class in project structure? PS: Specifically to intelij

zexicc
Автор

Why you didn't use acces modifiers to your classes members?

mariuspet
Автор

help, Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager. "" what does it mean, how do i fix it """

sweetcookitalys