01:198:213 Lecture 7: Software Methodology Lecture 7

42 views1 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents