*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes PGJC Exam - clarification? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "PGJC Exam - clarification?" Watch "PGJC Exam - clarification?" New topic
Author

PGJC Exam - clarification?

sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
Hi,
which statements concerning the relationships between the following classes are true?
class Foo {
int num;
Baz comp = new Baz();
}
class Bar {
boolean flag;
}
class Baz extends Foo {
Bar thing = new Bar();
double limit;
}
1.A Bar is a Baz
2.A Foo has a Bar
3.A Baz is a Foo
4.A Foo is a Baz
5.A Baz has a Bar
it is mentioned that there are 3 correct answers for this question.
I am sure abt 3 and 5. what is the other option?
-sanjana
Ashok Paulraj
Ranch Hand

Joined: Jul 07, 2003
Posts: 78
What abt. option 2, Baz is a Foo & Baz has a bar, hence, Foo has a Bar !!
~ Shalini
sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
It did not strike me at all..
Thanks Tauren.

-Sanjana
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 164
Taurean, I think your explanation is not quite right. The better explanation is Foo has a Baz and Baz has a Bar so Foo (indirectly) has a bar (whether Baz is a Foo or not).
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Taurean]: Baz is a Foo & Baz has a bar, hence, Foo has a Bar !!
A bird is an animal and a bird has wings, hence, animals have wings!!
Unless of course, they don't.
You could say that some animals have wings, or that some Foo subclasses have a Bar. But that's not really very helpful.
[sanjana]: it is mentioned that there are 3 correct answers for this question.
Nope. 3 and 5 are the only correct answers. If this is from a known mock exam, contact the author to let them know. If there's no way to contact the author, then the mock exam probably isn't reliable anyway; just ignore it.
[ January 21, 2004: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PGJC Exam - clarification?
 
Similar Threads
IS-A and HAS-A Relationship Doubts
HAS-A relation
Exam question - is a , has a- help!
classpath for the .java
Ch10:Development