Term
|
Definition
| The public methods of a class; define how the user interacts with the class. In Java, an interface is like an extreme abstract class; it can have no instance variables or private or protected methods. |
|
|
Term
| What does it mean to say an interface is also a type? |
|
Definition
| An interface is a type that can be satisfied by any class implementing the interface. |
|
|
Term
| What are the Comparable interface semantics? |
|
Definition
| well, in general one must say one's class implements Comparable. Then if you implement Comparable you must implement compareTo(Object o), but if you implement, say Comparable you can implement compareTo(Dog d) instead. |
|
|
Term
| What is the difference between an abstract class and an interface? |
|
Definition
Syntax: You extend a class but implement an interface. You can implement more than one interface but you can only extend one class. An interface has only method declarations with no implementations; it has no variables. |
|
|
Term
| T/F An interface may only contain method headers. |
|
Definition
| False - it may contain static final method declarations. But it may not contain any method implementations. |
|
|
Term
| T/F Interfaces may be extended |
|
Definition
|
|
Term
| T/F a class implementing an interface must implement *all* of the methods of the interface |
|
Definition
|
|
Term
| T/F A class can only implement one interface |
|
Definition
| False, and the syntax is like this: class Platypus implements Mammal, Bird{...} |
|
|
Term
| Classes that need to be sorted often use which interface? |
|
Definition
|
|
Term
| What is Java trying to simulate with interfaces? |
|
Definition
|
|
Term
| Does the compiler enforce the syntax of the Comparable interface? What about the semantics? |
|
Definition
| Syntax, yes; semantics, no. |
|
|
Term
| What sucks about ArrayLists? |
|
Definition
| Dude, they only hold objects. Srsly. You have to box and unbox your ints, chars, and longs. Also, they're a little less time and space efficient than arrays in some situations. |
|
|
Term
| What is awesome about ArrayLists? Like, as opposed to arrays. |
|
Definition
|
|
Term
| What is awesome about ArrayLists? Like, as opposed to arrays. |
|
Definition
|
|
Term
|
Definition
| A data structure designed to hold objects |
|
|
Term
| T/F an array is a container |
|
Definition
|
|
Term
| What are Java's two main supported container interfaces? |
|
Definition
|
|
Term
| What is the difference between Maps and Collections? |
|
Definition
| Collections contain individual objects while Maps have pairs (key and value). |
|
|
Term
| List some interfaces that extend Collections |
|
Definition
| Set, List, Vector, Arraylist, SortedSet, LikedList, AbstractCollection. |
|
|
Term
| What does the '?' in doSomething(ArrayList> arg1) mean? |
|
Definition
| It's a wildcard; it means that the ArrayList can be parameterized with any base type. |
|
|
Term
| What does extends String> do? How about super String> |
|
Definition
| Here limitations are being put on the wildcard; any descendant class of String can be used if the type is ? extends String, while any ancestor class of string can be used if the type is parameterized as ? super String. |
|
|
Term
| How can we make a collection into an array? |
|
Definition
| With the Object[] toArray() method. |
|
|
Term
| Can elements occur more than once in a class implementing the Set interface? What about the List interface? |
|
Definition
| elements can occur more than once in a List but not in a set. |
|
|