请问这段java代码为什么没有结果输出呀?
class a
{
int length;
int line[]=new int[9];
public synchronized void write(int n)
{
while (this.length<9)
line[this.length]=n;
}
public synchronized int read()
{
int m=0;
while (this.length>0)
m=line[this.length];
return m;
}
}
public class aa
{
public static void main(String args[])
{
int q;
a mmm=new a();
mmm.write(2);
q=mmm.read();
System.out.print(q);
}
}
编译能通过,但是没有结果,为什么?