returning a Void object

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-03-09T11:30:16Z Indexed on 2010/03/09 11:36 UTC
Read the original article Hit count: 171

Filed under:
|
|

What is the correct way to return a Void type, when it isn't a primitive? Eg. I currently use null as below.

interface B<E>{ E method(); }

class A implements B<Void>{

    public Void method(){
        // do something
        return null;
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about generics