Some interview questions
1. Can a class be defined as static?
Ans: An inner class can be declared as static. Like any other static method, a static member class has access to all static methods of the parent, or top-level class.
2. Can unreachable objects be made reachable?
Ans: Yes. An unreachable object is one where all references to it have been removed and the object is ripe for garbage collection. You can write code in the finalize method to once again get a reference to the hitherto unreachable object.
Ans: An inner class can be declared as static. Like any other static method, a static member class has access to all static methods of the parent, or top-level class.
2. Can unreachable objects be made reachable?
Ans: Yes. An unreachable object is one where all references to it have been removed and the object is ripe for garbage collection. You can write code in the finalize method to once again get a reference to the hitherto unreachable object.
0 Comments:
Post a Comment
<< Home