Like this:
Kernel kernel = new Kernel() {};
I can't figure out the name of it. I'd like to know what this is called so I can learn more about it, but unfortunately I haven't been able to find the answer myself through search engines.
Like this:
Kernel kernel = new Kernel() {};
I can't figure out the name of it. I'd like to know what this is called so I can learn more about it, but unfortunately I haven't been able to find the answer myself through search engines.
It's called an anonymous class. Excerpt from the Oracle tutorial:
The anonymous class expression consists of the following:
The new operator
The name of an interface to implement or a class to extend. In this example, the anonymous class is implementing the interface HelloWorld.
Parentheses that contain the arguments to a constructor, just like a normal class instance creation expression. Note: When you implement an interface, there is no constructor, so you use an empty pair of parentheses, as in this example.
A body, which is a class declaration body. More specifically, in the body, method declarations are allowed but statements are not.