0

问题是它说预期标识符,但我不知道预期什么

public class TTester 
    { 
    public static void main(String args[]) // main
    { 
    //the first integer in the tree is used to create the object 
       BST bstObj = new BST(50); // creating the object
       bstObj.addNode(56); 
       bstObj.addNode(52);     
       bstObj.addNode(25); //The numbers added
       bstObj.addNode(74); 
       bstObj.addNode(54); 
    } 
        bstObj.traverseAndPrint(bstObj.rootNode); // wanting to print the program
    } 
4

1 回答 1

2

在 JAVA 中,所有可执行语句必须仅在方法/块内。您的以下语句不是任何方法/块的一部分:

bstObj.traverseAndPrint(bstObj.rootNode); 

尝试将其移动到main方法中并进行测试。

于 2013-11-01T05:54:28.950 回答