CS 18000 Lecture Notes - Lecture 8: Instance Variable, A Reminder, Ryzen
Document Summary
Interface: a point where 2 systems interact, typically one system defines the interface and the other uses it. E. g. graphical user interface (gui): user -> computer, application programming interface (api): application program ->library of related methods. Java interface: defines a contract between a class that defines the interface and a class that implements the interface. Exists in its own file and includes method declarations but it has no method bodies (except default methods) and it has no fields (other than constants) May include fields that are implicitly declared as public, final and static, they are constants so they must be declared with an initializer. (cid:272)lasses (cid:373)ay de(cid:272)lare that they (cid:862)i(cid:373)ple(cid:373)e(cid:374)t(cid:863) a(cid:374) i(cid:374)terfa(cid:272)e. Gi(cid:448)e(cid:374) i(cid:374)terfa(cid:272)e doa(cid:271)le a (cid:272)lass he(cid:374)(cid:449)ay (cid:272)a(cid:374) i(cid:373)ple(cid:373)e(cid:374)t it: pu(cid:271)li(cid:272) (cid:272)lass he(cid:374)(cid:449)ay i(cid:373)ple(cid:373)e(cid:374)ts doa(cid:271)le { } All methods declared in doable must appear in henway (and other methods may appear, too) Example: we create an interface called cpu with these methods.