binarytreenode.java~1~
来自「源程序(包括最初的版本」· JAVA~1~ 代码 · 共 44 行
JAVA~1~
44 行
/** 二叉树结点类 */package datastructures;public class BinaryTreeNode{ // datastructures包内可见的数据成员 Object element; BinaryTreeNode leftChild; // 对左子树的引用 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 + =
减小字号Ctrl + -
显示快捷键?