这个错误怎么改??
public class Exercise2<T> {
Node pre = null;
boolean flag=true;
class Node {
T value;
Node left;// 左子树
Node right;// 右子树
public Node(T value,Node left,Node right) {
this.value=value;
this.left=left;
this.right=right;
}
public boolean isBST(Node root) {
// 实现...
// 根为空
int pre = Integer.MIN_VALUE;
if ( root==null ) {// 空树
return true;
}
// 检测左子树
if ( !isBST( root.left ) ){
return false;
}
// 检测根节点
// 如果当前节点的值小于或等于
if (root.value <=pre) return false;
// 更新前一个节点的值。
pre =(int) root.value;
// 检测右子树
return isBST( root.right );
}
}
}