Java List. Get () method: get the element at the specified position in the list
•
Java
get(int index)
Typical application
public static void main(String[] args){ List<String>list = new ArrayList<String>(); list.add("保护环境"); //向列表中添加数据 list.add("爱护地球"); //向列表中添加数据 list.add("从我做起"); //向列表中添加数据 String ret = list.get(1); System.out.println("获取索引位置为1的元素:"+ret); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码