jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes GC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "GC" Watch "GC" New topic


ushma agarwal

Joined: Sep 22, 2007
Posts: 13
somebody please tell me what are correct options and why?

thank you in advance!
Julio Eneriz

Joined: Nov 28, 2007
Posts: 15
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?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14961

Ushma, please quote your sources.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Julio Eneriz

Joined: Nov 28, 2007
Posts: 15
It seems that this topic was also commented here some time ago:

Jari Timonen
Ranch Hand

Joined: Jan 16, 2004
Posts: 232
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)

SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
Have you checked out Aspose?
subject: GC
It's not a secret anymore!