This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question from JDiscuss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question from JDiscuss" Watch "Question from JDiscuss" New topic

Question from JDiscuss

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Given the following code, which statements are true?

interface A
int value1 = 20;

class B implements A
int value1 = 10;


Select 1 correct option.

1. Class B implements interface A.
2. Class B is-a A.
3. class B has-a A
4. The above code will not compile.
5. value1 is overridden.

Answer given: option 1.

According to this thread option 2 is also correct.

web page

Please comment.

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

please comment
I agree that #2 is also correct, in that the term "IS-A" is commonly used to describe a relationship in which the class in question "is a" subtype of another class (useful in polymorphism). Because B implements A in the above example, B IS-A subtype of A and is usable wherever an instance of A is required (or at least *should* be, in principle - pun intended).

Do you have a question about this?
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks Steve.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
This question is from JDiscuss Test3.

I think the question has to modified to

select 2 correct answers.
I agree. Here's the link:
subject: Question from JDiscuss
It's not a secret anymore!