集册 Java实例教程 更新LinkedList项目

更新LinkedList项目

欢马劈雪     最近更新时间:2020-01-02 10:19:05

409
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
可以使用set方法将链接列表中的对象替换为其他对象。

import java.util.LinkedList;
/** from 时代Java公众号**/

public class Main {

  public static void main(String[] args) {

    LinkedList<String> officers = new LinkedList<String>();


    // add the original officers

    officers.add("Blake");

    officers.add("Burns");

    officers.add("Tuttle");

    officers.add("book2s");

    officers.add("Pierce");

    officers.add("nowjava.com");

    System.out.println(officers);
/** 来自 nowjava**/


    officers.set(2, 
展开阅读全文