Source: https://blog.csdn.net/qiaoquan3/article/details/53300248
Anonymous Object: no name of the object:
new new Car (); // anonymous object is actually shorthand format defined objects.
Car c = new Car();
c.run();
Anonymous object to write the code above:
new Car().run();
Use an anonymous object:
1 When the object of the method is invoked only once, when it can be reduced to an anonymous object.
As an object needs to be called Method 2 times, anonymous objects
new Car().run()
new Car().run()
This is the two objects are called run (), is not an object called a multi-method.
2 anonymous objects can be passed as actual parameters.
static void Show public (Car C)
{
// ......
}
show(new Car());