Interfaces
Introduction
Java API
Interfaces of the Java API
- The Java API defines many interfaces that you can implement in your classes.
- An interface that doesn't contain any constants or methods and that is primarily used to identify some aspect of the object is known as a tagging interface.
Some interfaces in the java.lang package
Interface | Methods | Description |
---|---|---|
Cloneable | None | Identifies the object as safe for cloning. |
Comparable | int compareTo(Object o) | Compares objects. |
Some interfaces in the java.util and java.awt.event packages
Interface | Members | Description |
---|---|---|
EventListener | None | Identifies the object as an event listener. |
WindowListener | void windowActivated(WindowEvent e) void windowClosed(WindowEvent e) void windowClosing(WindowEvent e) void windowDeactivated(WindowEvent e) void windowDeiconified(WindowEvent e) void windowIconified(WindowEvent e) void windowOpened(WindowEvent e) | Listens for events that occur during a window's life. |
ActionListener | void actionPerformed(ActionEvent e) | Listens for events that occur on GUI components. |