Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

GC

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
somebody please tell me what are correct options and why?



thank you in advance!
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the kind of exercise that is much easier to solve with a drawing.

The key is to remember that finalize may be call or not. So we are looking for a beginning of 4 printings with several possible endings (all combinations of 0 or 1 of each A1, A2 and A3).

The beginning of the output is well defined. a0 = a0.other() makes a0 point A1 and returns A1, which toString() method is invoked. Then the same A2, A3 and A1 again.

So every answer with a beginning A1A2A3A1 is valid if the end contains no more than one of A1, A2 or A3 in any order.

Does it make sense?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ushma, please quote your sources.
 
Julio Eneriz
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that this topic was also commented here some time ago:

https://coderanch.com/t/246147/java-programmer-SCJP/certification/Garbage-collection
 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<offtopic>

The key is to remember that finalize may be call or not.



This is correct(IMHO), but according to Whizlab it isn't. There's some other problems with Whizlab also regarding exceptions. There was two possible answers, but only one was correct (copied code to compiler and tested numerous times. Drag'n'Drop question)
</offtopic>
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic