+ 1

What is the difference between static inner class and inner class?

9th Apr 2020, 4:06 PM
Adham Empire
Adham Empire - avatar
7 Answers
+ 3
A class Nested or declared inside a class as static is called as static inner class. A non-static nested class is called as inner class just. Further differences are how and what they allowed to access...... See in this.. https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
9th Apr 2020, 5:47 PM
Jayakrishna 🇮🇳
10th Apr 2020, 10:45 AM
narayanaprasad
narayanaprasad - avatar
+ 1
Inner classes also k own as Non- Stack classes have access to other members of the top class, even if they are declared private while Static nested classes, do not have access to ther members of the top class.Inner 1 is our static inner class and inner 2 is our inner class which is not static.
10th Apr 2020, 10:53 AM
narayanaprasad
narayanaprasad - avatar
0
Adham Empire Added Question is not clear to me.. JFrame is the top level window that contains all other components like, button, lebel, text box,... etc. And this frame is added to the panel at top level so, Jpanel for JFrame is top level refference..
9th Apr 2020, 6:05 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 I need name of method
9th Apr 2020, 6:08 PM
Adham Empire
Adham Empire - avatar
0
JFrame tFrame = (JFrame) SwingUtilities.getWindowAncestor(this); Also Depending on how you implemented, then some methods that returns JFrame refference are.. getRoot(); //if frame is top level window JComponent.getTopLevelAncesto(); Refferences: https://stackoverflow.com/questions/9650874/java-swing-obtain-window-jframe-from-inside-a-jpanel https://stackoverflow.com/questions/9195422/how-to-reference-top-level-container-throughout-application-without-making-it-a
9th Apr 2020, 6:38 PM
Jayakrishna 🇮🇳