CSE 115 Lecture Notes - Lecture 22: List Of North American Broadcast Station Classes, Observer Pattern, Pattern Matching

40 views4 pages

Document Summary

Which of the following is not represented in an object diagram: method, object, variable, reference answer: a. method. What is an interface good for? it introduces a type so you can have variable of type. No instantiation: interfaces can not be instantiated; we can not create an instance of. Menukeylistener in the example above because the method has no definition. A class can implement an interface: public class eventhandler implements actionlistener { A class which implements an interface is obligated to provide full definitions of all the methods specified in the interface. Our class now looks like: public class eventhandler implements actionlistener { @override public void actionperformed(actionevent e) { (or in more concrete form): public class eventhandler implements actionlistener { When you define a class, you are defining a type. When you define an interface, you are also defining a type.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers