Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/what-makes-java-object-eligible-for-garbage-collection
Question 96 / 297:  What can be inserted at // insert code here, to make object created at line 5 eligible for garbage collection?
public static void main(String[] args) {

Integer[] arr = new Integer[3];

arr[0] = new Integer("3"); // Line 5

Integer x = arr[0];

// insert code here

}

A  arr[0] = null;
B  x = null;
C  arr = null; x = new Integer(450);
D  Any of the above
<< First < Previous Next > Last >>

Questions & Answers

material that allows electric current to pass through
Deng Reply
material which don't allow electric current is called
Deng
insulators
Covenant
how to study physic and understand
Ewa Reply
what is conservative force with examples
Moses
what is work
Fredrick Reply
the transfer of energy by a force that causes an object to be displaced; the product of the component of the force in the direction of the displacement and the magnitude of the displacement
AI-Robot
why is it from light to gravity
Esther Reply
difference between model and theory
Esther
Is the ship moving at a constant velocity?
Kamogelo Reply
The full note of modern physics
aluet Reply
introduction to applications of nuclear physics
aluet Reply
the explanation is not in full details
Moses Reply
I need more explanation or all about kinematics
Moses
yes
zephaniah
I need more explanation or all about nuclear physics
aluet
Show that the equal masses particles emarge from collision at right angle by making explicit used of fact that momentum is a vector quantity
Muhammad Reply
yh
Isaac
A wave is described by the function D(x,t)=(1.6cm) sin[(1.2cm^-1(x+6.8cm/st] what are:a.Amplitude b. wavelength c. wave number d. frequency e. period f. velocity of speed.
Majok Reply
what is frontier of physics
Somto Reply
A body is projected upward at an angle 45° 18minutes with the horizontal with an initial speed of 40km per second. In hoe many seconds will the body reach the ground then how far from the point of projection will it strike. At what angle will the horizontal will strike
Gufraan Reply
Suppose hydrogen and oxygen are diffusing through air. A small amount of each is released simultaneously. How much time passes before the hydrogen is 1.00 s ahead of the oxygen? Such differences in arrival times are used as an analytical tool in gas chromatography.
Ezekiel Reply
please explain
Samuel
what's the definition of physics
Mobolaji Reply
what is physics
Nangun Reply
the science concerned with describing the interactions of energy, matter, space, and time; it is especially interested in what fundamental mechanisms underlie every phenomenon
AI-Robot
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply
Explanation:

There are two references to the object created at line 5, a[0] and x.

Nulling only "arr" or "arr[0]" or "x", or making them point to other objects, is not enough.

We need to detach all the references to this object.

So, to make the object eligible for garbage collection, we can either :

1) set "arr" to null or to other object and set "x" to null or other object

2) or set "arr[0]" to null or other object and set "x" to null to other object

Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Madison Christian
Start Test
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>