Java - remove last known item from ArrayList

前端 未结 3 755
暖寄归人
暖寄归人 2021-02-11 16:39

OK, so here is my ArrayList:

private List clients = new ArrayList();

and here is what I am

3条回答
  •  心在旅途
    2021-02-11 17:17

    The compiler complains that you are trying something of a list of ClientThread objects to a String. Either change the type of hey to ClientThread or clients to List.

    In addition: Valid indices for lists are from 0 to size()-1.

    So you probably want to write

       String hey = clients.get(clients.size()-1);
    

提交回复
热议问题