Java 实例 - 链表修改

Java 教程 · 2019-02-11 14:41:58

以下实例演示了使用 listname.add() 和 listname.set() 方法来修改链接中的元素:

Main.java 文件

import java.util.LinkedList; public class Main { public static void main(String[] a) { LinkedList officers = new LinkedList(); officers.add("B"); officers.add("B"); officers.add("T"); officers.add("H"); officers.add("P"); System.out.println(officers); officers.set(2, "M"); System.out.println(officers); } }

以上代码运行输出结果为:

[B, B, T, H, P]
[B, B, M, H, P]

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

The Algorithm Design Manual

The Algorithm Design Manual

Steven S Skiena / Springer / 2011-11-14 / GBP 55.07

....The most comprehensive guide to designing practical and efficient algorithms.... Written by a well-known algorithms researcher who received the IEEE Computer Science and Engineering Teaching Aw......一起来看看 《The Algorithm Design Manual》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具