CSE 8B Lecture 9: Interface and Recursion

64 views2 pages

Document Summary

Cannot be instantiated as an object: too general/ generic to be defined as an object. Used as a superclass for inheritance and polymorphism. Can define some of its methods, but its abstract methods are the ones that the subclasses must implement. Used in place of abstract class when there is no default implementation to inherit. Can only declare public abstract method declarations & public static final constants. More flexible than classes: can define common super type for unrelated classes. No data/ method implementation is inherited subclass must implement all of the methods defined in the interface. If a class implements an interface, then that class"s type is also that interface type. Cannot create an instance, but you can create a reference variable of the interface type. Recursion is when a method calls itself within its method body. Why do we use it: perfect for problems where there is an obvious answer for some small problem.

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