To do: October 20
On the white board:
1. What is a similarity between an abstract class and an interface?
2. What is difference between an abstract class and an interface?
Tomorrow, I will not be in class. Mr. Newland will be administering a CS survey instrument during class. Will count as participation grade.
Another example of an interface: List
https://docs.oracle.com/javase/8/docs/api/java/util/List.html
List list1 = new List();
https://repl.it/@alicefisher/listInterface#Main.java
List interface
List list1 = new List();
error: List is abstract; cannot be instantiated
List interface
List list2 = new ArrayList();
list2 = new Stack();
list2 = new LinkedList();
List interface
List list2 = new ArrayList();
list2 = new Stack();
list2 = new LinkedList();
An ArrayList IS A List.
A Stack IS A List.
A LinkedList IS A List.
Go over homework
Abstract classes
Abstract classes are declared abstract and an abstract class may include:
Interface
What is an interface?
An interface is a list of methods that must be implemented.� �An interface may not contain any implemented methods.��Interfaces cannot have constructors!!!�
Type Parameters:�T - the type of objects that this object may be compared to
Compares this object with the specified object for order.
Interface Comparable <T>
int compareTo(T o)
currentObject.compareTo(parameterObject)
Repl.it Polygon interface
Repl.it lab sort by vowels
Homework:
Replit labs: Polygon interface and sort by vowels