Estoy intentando implementar Arboles binarios en java pero me da un error que no entiendo, me podrían ayudar?
Existe la interfaz y también el nodo con sus método, pero cuando implemento esta ultima clase me sale un error exactamente en esta linea Class Linked.... LinkedBinaryTree.class justo debajo del try
el cual es
error: not a statement LinkedBinaryTree 1bt= new LinkedBinaryTree();
y las siguientes dos lineas me dice que les falta ";" pero como se evidencia no es verdad
public class LinkedBinaryTree<T> implements BinaryTree<T>{
BinaryTreeNode<T> root;
static Method visit;
static Method theAdd1;
static Method theOutput;
static int count;
static{
try{
Class<LinkedBinaryTree> 1bt = LinkedBinaryTree.class;
theAdd1 = 1bt.getMethod("add1", BinaryTreeNode.class);
theOutput = 1bt.getMethod("output",BinaryTreeNode.class);
}
catch(Exception e){
//exception not possible
}
}
LinkedBinaryTree 1bt= new LinkedBinaryTree();
new LinkedBinaryTree()
, lo que tienes esLinkedBinaryTree.class
, no hay new. No me cuadra.