How can i display the result of the following method in a JavaFX TextArea Field instead of using print. when i use taf.appendText(printPreOrderRec(root));
where taf is an instance of TextArea, i get an error saying that void type not allowed here.
below is the Method , i want to display the result in taf. I want to notice that BSTNode is a Comparable.
private static void printPreOrderRec(BSTNode currRoot) {
if (currRoot == null) {
return;
}
System.out.printf("%d ", currRoot.data);
printPreOrderRec(currRoot.leftNode);
printPreOrderRec(currRoot.rightNode);
}
question from:
https://stackoverflow.com/questions/65840632/send-generic-type-to-textarea-field 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…