Core Java - Interview Questions and Answers

191. Identify the true statements about finalization.

a.A class may have only one finalize method
b.Finalizers are mostly used with simple classes
c.Finalizer overloading is not allowed
Ans: a,c.

192. When you write finalize() method for your class, you are overriding a finalizer
inherited from a super class.

a.true
b.false
Ans: a.

193. Java memory management mechanism garbage collects objects which are no longer referenced

a true
b.false
Ans: a.

194. are objects referenced by a variable candidates for garbage collection when the variable goes out of scope?

a yes
b. no
Ans: a.

195. Java's garbage collector runs as a ___ priority thread waiting for __priority threads to relinquish the processor.

a.high
b.low
Ans: a,b.

196. The garbage collector will run immediately when the system is out of memory

a.true
b.false
Ans: a.

197. You can explicitly drop a object reference by setting the value of a variable whose data type is a reference type to ___

Ans: null

198. When might your program wish to run the garbage collector?

a. before it enters a compute-intense section of code
b. before it enters a memory-intense section of code
c. before objects are finalized
d. when it knows there will be some idle time
Ans: a,b,d

199. For externalizable objects the class is solely responsible for the external format of its contents

a.true
b.false
Ans: a

200. When an object is stored, are all of the objects that are reachable from that object stored as well?

a.true
b.false
Ans: a

Post a Comment

Mới hơn Cũ hơn