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 classes]' - 9 question(s) found - Order By Newest
Q1. 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
Q3. Which of the following cannot be marked static ?
a. Constructors , Classes ( Outer ) , Classes ( nested ), Interfaces , Local variables , Inner Class methods and instance variables. b. Constructors , Classes ( Outer ) , Interfaces , Local variables , Class variables , Class Methods , Inner Class methods and instance variables. c. Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables. d. Constructors , Classes ( Outer ) , Classes (Nested), Interfaces , Local variables , Inner Class methods and instance variables
Ans. Constructors , Classes ( Outer ) , Interfaces , Local variables , Inner Class methods and instance variables.
Help us improve. Please let us know the company, where you were asked this question :
Ans. By encapsulating it within another class and declaring it private. In such a case, it will only be accessible through parent class or parent class object.
Help us improve. Please let us know the company, where you were asked this question :