⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 对已建立的单链表实现插人、删除、查找等基本操作
💻 JAVA
字号:
//import java.awt.*;
//import java.lang.*;

class Test{
	public static void main(String[] args)
	{
		LinkList L=new LinkList();

		L.add("6");
		L.add("5");
		L.add("4");
		L.add("3");
		L.add("2");
		L.add("1");
		System.out.println("The link is : ");
		L.display();
		System.out.println("-------------------------------------------");
		
		System.out.println("The length of the link is :"+L.getLength());
		System.out.println("-------------------------------------------");
		
		System.out.println("The second node is : "+L.getEntry(2));
		System.out.println("-------------------------------------------");
		
		if(L.isEmpty())      
			System.out.println("The node is  empty!");
		else
			System.out.println("The node is not empty!");
		System.out.println("-------------------------------------------");
		
		System.out.println("Add a new node 7 after the forth node : "); 
		L.add(4,"7");
		L.display();
		System.out.println("-------------------------------------------");
		
		System.out.println("Remove the fifth node : "); 
		L.remove(5);
		L.display();
		System.out.println("-------------------------------------------");
		
		System.out.println("The reverse of the link is : ");
		L.reverse();
		L.display();
		System.out.println("-------------------------------------------");
		
		System.out.println("After clearing the link : ");
		L.clear();
		L.display();
        System.out.println("-------------------------------------------");
        
		System.out.println("After clearing, the length of the link is : " + L.getLength());
		L.display();

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -