It's not a secret anymore!
The moose likes Junior/Associate Certification (SCJA,OCAJ 5/6/8) and the fly likes some questions, please answer it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Junior/Associate Certification (SCJA,OCAJ 5/6/8)
Bookmark "some questions, please answer it" Watch "some questions, please answer it" New topic

some questions, please answer it

ishan kalra
Ranch Hand

Joined: Dec 31, 2005
Posts: 30

i have encountered some questions, please tell me the exact answers

13.Which two techniques can be used to provide polymorphic behavior? Choose two

�Extending a class and adding a new method
�Implementing two interface in same class
�Extending the class and overriding a existing method
�Implementing a interfaces with several different classes

i am sure about 3rd option what other ?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

What are your answers? We don't do people's homework for them here, but you can get help with doing it yourself.

Start by taking your best shot at the answers.

[Asking smart questions] [About Bear] [Books by Bear]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

The word polymorphic means many forms (poly = many, mophic = forms).

So, polymorphism happens when an object can take on many forms. It really has to do with the instance that is created.

So, a person is a mammal, and an animal - that's two forms they can take on. A person can also be a spouse - that's another form they can take on. A person can be a dentist or a programmer - those are other forms.

In this scenario, if person were a class, maybe mammal would be a superclass, and perhaps animal would be an ancestor class. Spouse, programmer and dentist all seem like roles to me, so those might be modelled as interfaces.

So, extending a class, or implementing an interface, are ways that an instance of a subclass or implementing class can be polymorphic. That's what polymorphism is all about. Now, how that applies to your question is another story.

-Cameron McKenzie
I agree. Here's the link:
subject: some questions, please answer it
It's not a secret anymore!