I'm new to java and I'm still trying to understand the language, so I apologize if this question might sound noobish.
There's something I don't understand about listeners, sometime you can see a listener declared in such a fashion:
private View.OnClickListener onSave=new View.OnClickListener() {
public void onClick(View v) {
// Some code
}
};
or:
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
The thing that perplex me the most is that semicolon and parenthesis after the end of the method.
I understand inner classes for the purpose of having multiple listeners, but I don't understand this mixed declaration of variables and method.
Which purpose it has?
How is it declared?
WTF? :P
cheers :)