In the first case, being able to change the implementation without affecting the caller of the interface is one of the advantages of encapsulation. The example in the PDF mentions an interface method with the signature:
checkIsGreater(Object x, Object y) Any object/method that calls this method is the caller. So for example if the main method called: SomeComparisonObject.checkIsGreater(ObjectA, ObjectB); then the main method is the caller. The main method is not concerned with how checkIsGreater works, it only matters that the return type and parameter list remains the same. If for some reason the code inside checkIsGreater needs to be changed, then doing so will not affect other parts of the program so any changes should be confined to that method only. Following on from the above, your second question regarding compile time checking should be a bit easier to figure out. Because in this case the compiler is only concerned with checking method calls that are compatible with the method signatures. In this case the compiler checks against the interface (which is a form of abstraction) rather than against the implementation (which is not abstract i.e. it is 'concrete'). On 18/12/2009, at 1:01 AM, nn roh wrote: > Hi , > > I couldn't understand the highlighted text, it is one of reasons > why we use interface.. > > > To reveal an object's programming interface > (functionality of the object) without revealing its > implementation > – This is the concept of encapsulation > – The implementation can change without affecting > the caller of the interface what he mean by the > caller of the interface? > > > – The caller does not need the implementation at the > compile time ?? > > ● It needs only the interface at the compile time ? > > your help& sharing much appreciated , > > Thanks > Nada > > On Thu, Dec 17, 2009 at 3:23 PM, NISHANT BULCHANDANI <[email protected] > > wrote: > hello, > i don't know whether thios is the right place to ask.sry if m > wrong.well, i thought of learning java<start> and i have it this > sem... so if anyone could guide me how to use this resource and > about SCJP (its advantages...hw to start nd all).... > thanks > > > > > -- > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
