I am not asking about Interfaces in java, i am asking from general OOP point of view. A Class has an object and this object has some interface associated with it, which
tells that object what to do and how to do?
this is my point.
David Newton wrote:An interface is a type of contract: a class that implements an interface must, at minimum, include implementations of the interface.
Just keep in mind what David said. Is a type of contract. When a concrete class implements it, it will must implement it's methods.
Harnoor Singh wrote:Interface of the object is the method/methods through which it interacts with other objects or other part of program.
Absolutely this is what i was looking for, Thanks Harnoor Singh.
now my next question is that, is it right to say that we inherit interface of an object in inheritance and we do not inherit interface of an object in composition?
Correct: simply having a property that implements an interface doesn't mean the class now implements that same interface.
(It *can*, but in Java needs to be done manually, usually by delegating method calls to the property that implements the interface. Most IDEs can do this busy work automatically.)