1. What allows the programmer to destroy an object x?





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    Option D is correct. When an object is no longer referenced, it may be reclaimed by the garbage collector. If an object declares a finalizer, the finalizer is executed before the object is reclaimed to give the object a last chance to clean up resources that would not otherwise be released. When a class is no longer needed, it may be unloaded. Option A is wrong. I found 4 delete() methods in all of the Java class structure. They are: delete() - Method in class java.io.File : Deletes the file or directory denoted by this abstract pathname. delete(int, int) - Method in class java.lang.StringBuffer : Removes the characters in a substring of this StringBuffer. delete(int, int) - Method in interface javax.accessibility.AccessibleEditableText : Deletes the text between two indices delete(int, int) - Method in class : javax.swing.text.JTextComponent.AccessibleJTextComponent; Deletes the text between two indices None of these destroy the object to which they belong. Option B is wrong. I found 19 finalize() methods. The most interesting, from this questions point of view, was the finalize() method in class java.lang.Object which is called by the garbage collector on an object when garbage collection determines that there are no more references to the object. This method does not destroy the object to which it belongs. Option C is wrong. But it is interesting. The Runtime class has many methods, two of which are: getRuntime() - Returns the runtime object associated with the current Java application. gc() - Runs the garbage collector. Calling this method suggests that the Java virtual machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the virtual machine has made its best effort to recycle all discarded objects. Interesting as this is, it doesn't destroy the object.
Show Similar Question And Answers
QA->When an object travels around another object it is known as?....
QA->When an object is heated, the molecules of that object?....
QA->World's first woman computer programmer ?....
QA->Which is the phase that invades but does not destroy the lost?....
QA->Which destroy the toxic substance found in digested food?....
MCQ->What allows the programmer to destroy an object x?....
MCQ->Which of the following statements are correct about the C#.NET code snippet given below? sample c; c = new sample(); It will create an object called sample. It will create a nameless object of the type sample. It will create an object of the type sample on the stack. It will create a reference c on the stack and an object of the type sample on the heap. It will create an object of the type sample either on the heap or on the stack depending on the size of the object.....
MCQ->public Object m() { Object o = new Float(3.14F); Object [] oa = new Object[l]; oa[0] = o; / Line 5 / o = null; / Line 6 / oa[0] = null; / Line 7 / return o; / Line 8 / } When is the Float object, created in line 3, eligible for garbage collection?....
MCQ->class HappyGarbage01 { public static void main(String args[]) { HappyGarbage01 h = new HappyGarbage01(); h.methodA(); / Line 6 / } Object methodA() { Object obj1 = new Object(); Object [] obj2 = new Object[1]; obj2[0] = obj1; obj1 = null; return obj2[0]; } } Where will be the most chance of the garbage collector being invoked?....
MCQ->A program will have one function prototype for each function defined in the programmer-defined section of the program. (Assume that the programmer-defined section is located below the main function.)....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution