为什么会出现如图的情况
public class Test {
static char[] a = { '-', '-', '-', '-' };
static char v = '*';
public static void main(String[] args) {
new Thread() {
@Override
public void run() {
while (true) {
for (int i = 0; i < a.length; i++) {
a[i] = v;
}
v = (v == '*' ? '-' : '*');
}
}
}.start();
new Thread() {
@Override
public void run() {
while (true) {
System.out.println(Arrays.toString(a));
}
}
}.start();
}
}