我在向一个Vector添加数据的时候,系统提示我:在使用ADD方法之前没有检查,代码如下:
public static void enQueue(String str) 
{
   
        synchronized (v1 )
                     {                     while( v1.size()>=100*1024 )
                         {
                          System.out.print("Waiting..........");
                              try{
                                   v1.wait();
                                    }catch(Exception e)
                                             {e.printStackTrace();}
                                          //while
                             }                       // v1.addElement(obj);
                      
                        v1.add(str);
          
       // System.out.println(String.valueOf(v1.firstElement()));
        
                       v1.notifyAll();
      
       // thread = new CreateThread(IP,PORT);
             // thread.start();


            }
}