It also contains Void.TYPE, useful for testing return type with reflection:

Java 中的 Void 类有啥用?_java


Say you want to have a generic that returns void for something:

abstract class Foo<T>
{
    abstract T bar();
}

class Bar
    extends Foo<Void>
{
    Void bar()
    {
        return (null);
    }
}

What is the need of Void class in Java [duplicate]

https://stackoverflow.com/questions/2352447/what-is-the-need-of-void-class-in-java