如何使以下方法返回 a character array
?
public char[] startThread() {
// arr declaration
Runnable r = new Runnable() {
@Override
public void run() {
arr = getArray(); // arr assignment
}
};
new Thread(r).start();
return arr;
}
char arrNew[] = startThread();
注意:上面的代码片段会产生错误