Java - 从 ArrayList 中删除最后一个已知项
好的,所以这是我的:ArrayList
private List<ClientThread> clients = new ArrayList<ClientThread>();
这就是我正在尝试做的事情:
我正在尝试从我上面发布的中删除最后一个已知项目。我正在尝试使用下面的代码执行此操作:ArrayList
} catch(SocketException re) {
String hey = clients.get(clients.size());
ClientThread.remove(hey);
System.out.println(hey + " has logged out.");
System.out.println("CONNECTED PLAYERS: " + clients.size());
}
但我得到这个错误:
C:\wamp\www\mystikrpg\Server.java:147: incompatible types
found : Server.ClientThread
required: java.lang.String
String hey = clients.get(clients.size());
^
C:\wamp\www\mystikrpg\Server.java:148: cannot find symbol
symbol : method remove(java.lang.String)
location: class Server.ClientThread
ClientThread.remove(hey);
^
2 errors
我做错了什么?它应该从我的中删除最后一个已知项目。ArrayList