Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Nested class vs sub class' - 1 question(s) found - Order By Newest | ||||
| ||||
Ans. Inner Class is a class that is nested within another class whereas sub class is a class that extends or inherit another class. Inner class can only be accessed using reference of outer class ( Class name , if inner class is static or object reference, if inner class is non static ) whereas Sub class is accessed directly. In terms of memory, inner class is stored just like another class having it's own body whereas sub class carries the body of parent class as well as it's own fields in memory. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  inner classes  nested classes  inner class vs sub class  nested class vs sub class Basic | ||||
Related Questions | ||||
Which of the following can be marked static ? a. Methods , Variables and Initialization Blocks. b. Methods , Variables , Initialization Blocks and Outer Classes and nested Classes. c. Methods , Variables , Initialization Blocks and Outer Classes. d. Methods , Variables , Initialization Blocks and nested Classes | ||||
Difference between nested and inner classes ? | ||||
What is a nested interface ? | ||||
Which of the following cannot be marked static ? | ||||
Explain use of nested or inner classes ? | ||||
What is the benefit of inner / nested classes ? | ||||
Explain Static nested Classes ? | ||||
Can we have an inner class within Interface ? | ||||
Upon compiling the following class, What .class files will get created public class OuterClass{ class InnerClass{ } } | ||||