List a=new List(4);
.........
if (a.getItemCount()==0) {
//此时为空
}

解决方案 »

  1.   

    List interface 有下面这个接口
    boolean isEmpty();
    也有,int size();
      

  2.   

    楼上那位两个星的家伙,
    List a=new List(4);   ?????Interface有构造函数吗?
    .........
    if (a.getItemCount()==0) ??????List Class有这个函数吗?
      

  3.   

    List 沒有getItemCount()這個方法
    也沒有isEmpty()這個方法
    size不可用, 有一個List.getLastVisibleIndex()方法
    if(List.getLastVisibleIndex()==-1){//為空
    }
      

  4.   

    hayai(生命树) java.awt.List
        哈是楼主自己说列表框当然就是这个了 看清楚点
    inprise_lyj(只愛一點點) :怎么会没有?jdk1.4
      

  5.   

    getItemCountpublic int getItemCount()
    Gets the number of items in the list.Returns:the number of items in the listSince:JDK1.1See Also:getItem(int)或者
    public int countItems()
    Deprecated. As of JDK version 1.1, replaced by getItemCount().
    看看你的jdk是多少推荐有第一种
      

  6.   

    你可以用myList.isEmpty()来判断
    也可以用myList == null || myList.size() == 0要注意的是如果myList = null; 你直接用myList.size() == 0 来判断的话会跑出异常的
      

  7.   

    注意大家看清楚
    java.util.List Interface 
    and
    java.awt.List是不一样的!!!!!!!!!!