求教
出现了好多问题,不知道怎么回事
class test
{
public static void main(String[] args)
{
queue q=new queue();
Pruducer p=new Pruducer(q);
Custumer c=new Custumer(q);
p.start();
c.start();
}
}
class Pruducer extends Thread
{
queue q;
Pruducer(queue q)
{
this.q=q;
}
public void run()
{
for(int i=0;i <10;i++)
{
q.put(i);
System.out.println( "pruducer= "+i);
}
}
}
class Custumer extends Thread
(
queue q;
Custumer(queue q)
{
this.q=q;
}
public void run()
(
while(ture)
{
System.out.println( "custumer= "+q.get());
}
)
)
class queue
{
int value;
public void put(int i)
{
value=i;
}
public int get()
{
return value;
}
}
------解决方案--------------------确实好多错误,true不是ture,类要用{}包围,而你用了()。
------解决方案--------------------