Answer: inner class and local variable : Questions « Object Oriented « SCJP
Java Source And Data Type
6.15.18.Answer: inner class and local variable
Inner classes cannot use any non-
variables declared in the method.
Java garbage collector executes as a low-priority, background thread(True/False).
Answer: garbage collection thread
Java garbage collector keeps track of which objects are reachable and unreachable(True/False).
Answer: garbage collection and reachable and unreachable objects
Java garbage collector can be directed to garbage collect specific objects(True/False).
Answer: garbage collection and specific objects
An object's finalize() method can be invoked multiple times by the garbage collector(True/False).
Answer: calling to finalize method
If an object's finalize() method is invoked, the object will be garbage collected(True/False).
Answer: finalize method and garbage collection
If the object has been garbage collected, its finalize() method has been invoked(True/False).
Answer: calling to finalize method and garbage collection
An object's finalize() method must perform cleanup operations(True/False).
Answer: finalize method and cleanup
The inner class will have access only to static variables in the enclosing class(True/False).
Answer: inner class and static variables
The inner class can use any variables declared in the method(True/False).
Answer: inner class and local variable
The inner class can use only local variables that are declared final(True/False).
Answer: final local variable and inner class
The inner class can use only local variables that are declared static(True/False).
Answer: static local variable and inner class
Which of the following code fragments shows the correct way to declare and initialize a reference to a NestedClass object from outside NormalClass?
Answer: static nested class definition
Which of the following code fragments shows the correct way to declare and initialize a reference to a NestedClass object from outside BaseClass?
Answer: nested class and outter class
Which variables would be able to use in place of XX?
Answers: varible reference for inner class
An inner class can have the same name as its enclosing class(True/False).
Answer: naming the inner class
An instance of a nonstatic inner class always has an associated instance of the enclosing class(True/False).
Answer: non-static inner class
What is the output when compiling and running the following code?
Answer: overloading method call
What happens when you try to compile and run the following code?
Answer: Compare Integer and Long
Is the following code a proper way to override?
Answer: how to override
What is the output when compiling the following code
Answer: overriding method and return value
What happens when you try to compile another class that includes the following method?
Answer: abstract class
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.