5. 29. 1. Interfaces and Abstract Classes |
|
- The interface should be regarded as a contract between a service provider and its clients.
- An abstract class is a class that cannot be instantiated
- An abstract class must be implemented by a subclass.
- In Java, the interface is a type.
|
Follow this format to write an interface: |
accessModifier interface interfaceName {
}
public interface Printable {
void print (Object o);
}
|
|
- The Printable interface has a method, print.
- print is public even though there is no public keyword.
|