packageA;importjava.util.Scanner;publicclassMainClass{publicstaticvoidmain(String[]args){LListlist=newLList();Scannerscanner=newScanner(System.in);Syste...
package A;
import java.util.Scanner;
public class MainClass {
public static void main(String[] args) {
LList list = new LList();
Scanner scanner = new Scanner(System.in);
System.out.println("请依次输入数据:");
int newVal =scanner.nextInt();
for(int i=0;i
{
int new1 =scanner.nextInt();
System.out.println(list.add(new1));
}
System.out.println(list.toString(list.front));
System.out.println("添加元素");
System.out.println("请输入添加个数");
newVal =scanner.nextInt();
for(int i=0;i
{
System.out.println("请输入第"+i+"的位置");
int n,new1;
n=scanner.nextInt();
new1=scanner.nextInt();
System.out.println(list.add(n, new1));
}
System.out.println(list.toString(list.front));
System.out.println("删除元素");
System.out.println("请输入删除个数");
newVal =scanner.nextInt();
for(int i=0;i
{
System.out.println("请输出第"+(i+1)+"的位置和数据");
int n;
n=scanner.nextInt();
System.out.println(list.remove(n-1));
}
System.out.println(list.toString(list.front));
System.out.println("取数元素");
System.out.println("请输入取数个数");
newVal =scanner.nextInt();
for(int i=0;i
{
System.out.println("请输出你要取第"+(i+1)+"的位置");
int n;
n=scanner.nextInt();
System.out.println(list.find(n-1).nodeValue);
}
System.out.println("将最小的数据移至前面");
int t = list.findmax();
System.out.println(t);
if(t>=0){
int new2 = list.find((t)).nodeValue;
System.out.println(new2);
list.remove((t));
list.add(0, new2);
System.out.println(list.toString(list.front));
}
else{
System.out.println("数据结构有限 无法转化");
}
}
}
我知道这段程序会实现什么功能,但是我不懂语句都是什么意思?谁能帮我加一些注释,或者写一段详细的分析。
展开