What is a synthetic class in Java? Why should it be used? How can I use it?
If I get it right, a synthetic class is one generated on the fly, without having to give it an explicit name. For example:
//...
Thread myThread = new Thread() {
public void run() {
// do something ...
}
};
myThread.start();
//...
This creates a synthetic subclass of Thread and overrides its run() method, then instantiates it and starts it.