GeekInterview.com
Series: Subject: Topic:
Question: 78 of 78

In interfaces the methods just defined without implementation then what is the purpose of defining the methods?

Asked by: Interview Candidate | Asked on: Sep 26th, 2005
Showing Answers 1 - 8 of 8 Answers
lavankannan

Answered On : Oct 5th, 2005

    The interface is just declared,so that u can use the methods were ever u want.the definition of the methods is given smewhere.it is easy to call the methods only with the method name.the method name refers and takes the declaration parts.

  
Login to rate this answer.

As By giving the Methods(Declaring) in Interface , We are telling to must follow exactly the same Signature for the given Methods. This wil be used when we are writing RMI Applications . Because in this case we just give the Interface to the User, so that user will come to know the Signature of the Method and later he/she will call it.

  
Login to rate this answer.
raviegp

Answered On : Feb 27th, 2006

View all answers by raviegp

interfaces are meant for abstraction of data ie only method declarations are provided so that any class implementing the interface it will give the specific implementation according to the requirements.we must place only methods for which the implementation is user specific and not known at the time of designing the interface.

  
Login to rate this answer.
TDeepika

Answered On : Mar 7th, 2006

View all answers by TDeepika

In interfaces we implement the reusability& polymorphism concept. Each class that implements the interface is going to define the same method in its own way based on its conditions. with interfaces we can support dynamic method resolution at runtime .

  
Login to rate this answer.
RK

Answered On : Apr 23rd, 2007

Interfaces are like Contract/Agreement that defines the precedure that we have to follow. When the class implements an interface, it guarantees that it has implemented the methods of the interface.

  
Login to rate this answer.

Anyclassfrom anyinheritence tree canimplementthe interface methods by its own way.

  
Login to rate this answer.
chaitu

Answered On : Aug 8th, 2007

We declare methods in interfaces, by declaring these methods weprovide signature of method to the class which implements this class.one interface can be implemented by any number of classes. By implementing interfaceclasses follow thesignature given in the interface. The classes must overide all methods in interface.

  
Login to rate this answer.

An Interface force the end user to implement all the methods declared in the interface, in this way it is ensured that all the extending classes of a particular interface are implementing the same functionality but in their own specific way. for e.g there is an interface called Bank which has several methods now there are several other classes like CitiBank, HDFCBank which extends this Bank interface so they all have to implement the same methods defined in the Bank interface but the implementation logic of those methods could be different.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.