current position:Home>Java linked list linkedlist

Java linked list linkedlist

2022-09-23 03:32:29CSDN Q&A

After importing the linkedlist package, is it true that each node of this class can only store one piece of data, such as the following, how can I store the student number name at the same time after importing the package instead of only storing the student number like this?

import java.util.LinkedList;import java.util.Scanner;public classSList { public static void main(String[] args) { LinkedList<Integer> LA=new LinkedList(); LinkedList<Integer> LB=new LinkedList(); System.out.println("Please enterNumber of nodes in LA"); Scanner sc=new Scanner(System.in); int a=sc.nextInt(); System.out.println("Please enter a value"); for (int i=0;iint x=sc.nextInt(); LA.add(x); }

copyright notice
author[CSDN Q&A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/266/202209161141466594.html

Random recommended