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

查看所有标签

Haskell

Haskell

Simon Thompson / Addison-Wesley / 1999-3-16 / GBP 40.99

The second edition of Haskell: The Craft of Functional Programming is essential reading for beginners to functional programming and newcomers to the Haskell programming language. The emphasis is on th......一起来看看 《Haskell》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具