1. Static member classes
Static member class is a static member of a class.
Like any other static method, a static member class has access to all static methodsof the parent, or top-level, class.
2. Member classes
Member class is also defined as a member of a class.
Unlike the static variety, the member class is instance specific and has access toany and all methods and members, even the parent's this reference.
3. Local classes
Local Classes declared within a block of code and these classes are visible only within the block.
4. Anonymous classes
These type of classes does not have any name and its like a local class.
Example
button1.addActionListener(
new java.awt.event.ActionListener() { <---- Anonymous class
public void actionPerformed(java.awt.event.ActionEvent e) {
// do something
}
} );
No comments:
Post a Comment
Note: only a member of this blog may post a comment.