Exact error: "Error: Main method not found in class Node, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application"
class Node{
int key;
Node left, right;
public Node(int item){
key = item;
left = right = null;
}
}
class BinaryTree{
Node root;
BinaryTree(){
root = null;
}
void printPostorder(Node node){
if(node == null)
return;
printPostorder(node.left);
printPostorder(node.right);
System.out.print(node.key + " ");
}
void printPostorder(){ printPostorder(root);}
public static void main(String[] args){
BinaryTree tree = new BinaryTree();
tree.root = new Node(1);
tree.root.left = new Node(2);
tree.root.right = new Node(3);
System.out.println("\nPostorder: ");
tree.printPostorder();
}
}
But the main function has been defined.
Nodeclass, in what appears to be a file calledNode.java- Federico klez Culloca