1:
Topic requirements
Textbook p448 Example15_4
- Add three students after your student number to the list. The student number is the last three students to join from the 1st
- Submit a screenshot of the running result
- Engrave the push code to the code cloud
2:
The title requires
public class MyList {
public static void main(String [] args) {
//Select the appropriate construction method and create four nodes with the student numbers of two students before and after your student number
//把上面四个节点连成一个没有头结点的单链表
//遍历单链表,打印每个结点的
//把你自己插入到合适的位置(学号升序)
//遍历单链表,打印每个结点的
//从链表中删除自己
//遍历单链表,打印每个结点的
}
}
public class Node
public Node(T data, Node<T> next) //构造结点,data指定数据元素,next指定后继结点
{
this.data = data; //T对象引用赋值
this.next = next; //Node<T>对象引用赋值
}
public Node()
{
this(null, null);
}
public String toString() //返回结点数据域的描述字符串
{
return this.data.toString();
}
}