aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question from JDiscuss" Watch "Question from JDiscuss" New topic
Author

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;
}

Options

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.
 
wood burning stoves
 
subject: Question from JDiscuss