📄 binarytreenode.java
字号:
/** 二叉树结点类 */package datastructures;public class BinaryTreeNode{ // datastructures包内可见的数据成员 protected Object element; protected BinaryTreeNode leftChild; // 对左子树的引用 protected BinaryTreeNode rightChild; // 对右子树的引用 // 三个重载的构造方法 public BinaryTreeNode() {} public BinaryTreeNode(Object theElement) {element = theElement;} public BinaryTreeNode(Object theElement, BinaryTreeNode theleftChild, BinaryTreeNode therightChild) { element = theElement; leftChild = theleftChild; rightChild = therightChild; } // 访问性方法 public BinaryTreeNode getLeftChild() {return leftChild;} public BinaryTreeNode getRightChild() {return rightChild;} public Object getElement() {return element;} // 针对数据成员的变异性方法 public void setLeftChild(BinaryTreeNode theLeftChild) {leftChild = theLeftChild;} public void setRightChild(BinaryTreeNode theRightChild) {rightChild = theRightChild;} public void setElement(Object theElement) {element = theElement;} // 输出数据元素方法 public String toString() {return element.toString();}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -