I am currently teaching a course in Java, and I came across some confusing code.
Example:
Runnable runnable = new Runnable()
{
public void run()
{
}
};
I really don't understand what this code does.
How can a start method be associated with an instance of a class?
I googled "Runnable" and found out that it is an interface. Am I implementing an interface by declaring a run method between curly braces? Can this be done for any interface in java?
I could use some links / explanations. Thank!
source
share