java:
public class ListNode {
public int value;
ListNode next;
public ListNode(){
}
public ListNode(int value){
this.value=value;
}
public ListNode(int value, ListNode next) {
this.value = value;
this.next = next;
}
}
python:
class ListNode:
def __init__(self, val, next=None):
self.val = val
self.next = next
c++:
struct ListNode {
int val; // 节点上存储的元素
ListNode *next; // 指向下一个节点的指针
ListNode(int x) : val(x), next(NULL) {} // 节点的构造函数
};