01:198:213 Lecture 7: Software Methodology Lecture 7
Document Summary
Comparing for inequality in a library module. We know is some object, but object does not define a comparison method. We need to specify that cannot be any object but only objects that can be comparable. Must be checkable by compiler so that compilation will succeed and the client s call will be guaranteed to send the correct type of object. Java comparable interface defines a compareto method without a body. Client is required to fill in the compareto method accordingly. vs class extends comparable Implicit interface - public members of a class. The way by which an object can be manipulated by its client the public fields and methods of an object comprise its implicit interface. Using the keyword interface to define an explicit interface that can be implemented by classes. An interface defines a new type that is tracked by the compiler. All fields in an interface are constants: public, final, and static.