1. class X2 { public X2 x; public static void main(String [] args) { X2 x2 = new X2(); / Line 6 / X2 x3 = new X2(); / Line 7 / x2.x = x3; x3.x = x2; x2 = new X2(); x3 = x2; / Line 11 / doComplexStuff(); } } after line 11 runs, how many objects are eligible for garbage collection?





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
    This is an example of the islands of isolated objects. By the time line 11 has run, the objects instantiated in lines 6 and 7 are referring to each other, but no live thread can reach either of them.
Show Similar Question And Answers
QA->The batting average for 40 innings of a cricket player is 50 runs. His highest score exceeds his lowest score by 172 runs. If these two innings are excluded, the average of the remaining 38 innings is 48 runs. Find out the highest score of the player.....
QA->Average height of 10 students in a class is 150 cm. A boy of height 160 cm left the class and a boy of height 148 cm is admitted. Then what is the average height of the students in the class now?....
QA->There are 50 students in a class. In a class test 22 students get 25 marks each, 18 students get 30 marks each. Each of the remaining gets 16 marks. The average mark of the whole class is :....
QA->A batsman make a score of 80 runs in his 16th innings and thereby increasing his average by 2 runs. Find his average after 16th innings....
QA->In a class of 30 children 40% are girls. How many more girls coming to this class would make them 50%?....
MCQ->public class X { public static void main(String [] args) { X x = new X(); X x2 = m1(x); / Line 6 / X x4 = new X(); x2 = x4; / Line 8 / doComplexStuff(); } static X m1(X mx) { mx = new X(); return mx; } } After line 8 runs. how many objects are eligible for garbage collection?....
MCQ->class X2 { public X2 x; public static void main(String [] args) { X2 x2 = new X2(); / Line 6 / X2 x3 = new X2(); / Line 7 / x2.x = x3; x3.x = x2; x2 = new X2(); x3 = x2; / Line 11 / doComplexStuff(); } } after line 11 runs, how many objects are eligible for garbage collection?....
MCQ->What will be the output of the program? public class CommandArgs { public static void main(String [] args) { String s1 = args[1]; String s2 = args[2]; String s3 = args[3]; String s4 = args[4]; System.out.print(" args[2] = " + s2); } } and the command-line invocation is > java CommandArgs 1 2 3 4

....
MCQ->What will be the output of the program? public class Test138 { public static void stringReplace (String text) { text = text.replace ('j' , 'c'); / Line 5 / } public static void bufferReplace (StringBuffer text) { text = text.append ("c"); / Line 9 / } public static void main (String args[]) { String textString = new String ("java"); StringBuffer textBuffer = new StringBuffer ("java"); / Line 14 / stringReplace(textString); bufferReplace(textBuffer); System.out.println (textString + textBuffer); } }....
MCQ->class Bar { } class Test { Bar doBar() { Bar b = new Bar(); / Line 6 / return b; / Line 7 / } public static void main (String args[]) { Test t = new Test(); / Line 11 / Bar newBar = t.doBar(); / Line 12 / System.out.println("newBar"); newBar = new Bar(); / Line 14 / System.out.println("finishing"); / Line 15 / } } At what point is the Bar object, created on line 6, eligible for garbage collection?....
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