Adding Method in Java

Hi
I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect,
Thanks
Kalins Naik

Questions by kalins.naik

Showing Answers 1 - 3 of 3 Answers

Vaibhav

  • Aug 20th, 2012
 

You can use inheritance for that... You can inherit new class from the Existing class and add the method in that.

akii

  • Apr 30th, 2013
 

make a class abstract in this class you do not need to implement all methods of interface .

  Was this answer useful?  Yes

If we implement any new method in Interface then by default that method is public and abstract, So the classes which are implementing that interface should implement that method that is one way in which the following classes will not affect.

Another way is make the class as abstract so that no need to implement all the methods of interface. Here what you have to think is we have two ways to make the followed classes will not affect, in those two ways select the best way to resolve your problem.

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions