Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
void run() { ... if (done) return cancel(); ... } where cancel() return void. This won't compile... and I can almost understand why. But if I want to return a void from a void, why not? Instead, I end up writing something like this: if (done) { cancel(); return; } I'm not looking for code style suggestions, I want to know why Java expressly prohibits this type of void r...
Is null an Object in Java?
There is a Java Void -- uppercase V-- reference type. The only situation I have ever seen it used is to parameterize Callables final Callable<Void> callable = new Callable<Void>() { public Void call() { foobar(); return null; } }; Are there any other uses for the Java Void reference type? Can it ever be assigned an...
I can't answer completely "why should we call "void" is 'return type'?" How do I prove that "void" is a type? :: in JAVA
I realize this issue is somewhat trivial, but I'm interested in knowing the "correct" answer. I'm trying to extend android.os.AsyncTask<Params, Progress, Result>, but my task doesn't require any parameters. Given that I have to overload protected Result doInBackground(Params... params), what is the "best" way to pass in no parameters? Currently, I'm using Object as the Params type and...
Sorry for the title :-/ I wrote a parser for a calculator. It works, but I don't like my token hierarchy. The parser should be unaware of the concrete number type, e.g. it should be configurable for Double, BigDecimal etc. So I have a generic token interface public interface Token<T> { } public class NumToken<T> { private final value T; ... } public class OperatorToken<T...
Trying to write a UDP client-server application using Swing. Each instance of the client should be able to send messages to the Server (from the event dispatch thread) and also continuously listen for messages from other clients relayed through the server (on a worker thread using SwingWorker). I'm trying to implement a ListenWorker class now whose doInBackground method will continuously listen...
Here is the code, class Car { public static String owner; public static String car; public static Integer plate_num; public static String car_color; Car(String owner, String car_name, Integer num, String color) { owner = owner; car = car_name; plate_num = num; car_color = color; } Void display () { System.out.println...
My Java app uses a java.util.concurrent.Executors.newCachedThreadPool() to launch a number of different threads that do different kinds of work. Some of the threads return a value. For these, I am using Future.get() to retrieve the value from the thread. Other threads don't return a value that I care about. They are declared to return an Object, and the returned value is always null. For t...
 /*
  * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.lang;

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.

Author(s):
unascribed
Since:
JDK1.1
public final
class Void {

    
The Class object representing the pseudo-type corresponding to the keyword void.
    public static final Class<VoidTYPE = Class.getPrimitiveClass("void");
    /*
     * The Void class cannot be instantiated.
     */
    private Void() {}
New to GrepCode? Check out our FAQ X