How to make this method return an array?


How can I make the following method return a character array ?

public char[] startThread() {
    // arr declaration
    Runnable r = new Runnable() {
        public void run() {
            arr = getArray(); // arr assignment
    new Thread(r).start();
    return arr;

char arrNew[] = startThread();

Note : The above snippet generates an error

Look for java.util.concurrent.Callable, its similar to runnable but returns a value.


If in 1.6 JDK, you can look for Future objects.