Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Question for varargs for array and garbage collection

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The following is from Mr. Devaka's ExamLab SCJP Simulator :
Practice Exam 1, question 42:

How many objects are eligible for the Garbage Collector, after executing the line-9 of this programm. F.Y.I: Array is an object.



According to ExamLab the answer is: 0


This problem is already discussed here but one forum is showing answer 1 and one is showing 0. which is true ? Can anyone help me.


Solution 1 :https://coderanch.com/t/418039/Programmer-Certification-SCJP/certification/about-Garbage-Collection-from-ExamLab#1843490

Solution 2 : https://coderanch.com/t/431013/Programmer-Certification-SCJP/certification/Devak-ExamLab-Garbage-Collection#1914089



Thanks
Puja
 
Sheriff
Posts: 6888
1312
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When did you download examlab? Before April, or After April?
 
PujaR Agarwal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded examlab after april only but it is showing 19/4/09 version.
 
Devaka Cooray
Sheriff
Posts: 6888
1312
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

PujaR Agarwal wrote:I downloaded examlab after april only but it is showing 19/4/09 version.



Then please read the question again:

How many "objects of Gabc class" are eligible for the Garbage collector, after executing the line-9 of this program?


The correct answer is 0 in this case.

(There was a small error in the previous version)
 
PujaR Agarwal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Devaka to make it clear.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic