Page 1 of 1

can someone explain how to correct this?

Posted: Fri May 20, 2022 6:12 pm
by answerhappygod
can someone explain how to correct this?
Can Someone Explain How To Correct This 1
Can Someone Explain How To Correct This 1 (56.58 KiB) Viewed 22 times
public class IntTree { private IntTreeNode overallRoot; public int countEvenBranches () { return evenBranches (overallRoot); } public int evenBranches (IntTreeNode root) { if (root == null) { return 0; } else if (root.data % 2 == 1 || root.left == null && root.right == null) { return evenBranches (root.left) + evenBranches (root.right); } else { return 1 + evenBranches (root.left) + evenBranches (root.right); } } public static void main(String[] args) { System.out.println(new IntTree("[2 [8 [O] null] [1 [7 [4] null) [6 null [9]]]]").evenBranches()); } // Constructs a tree with default numbers public IntTree() { overall Root = null; } // Constructs a tree from the given text representation public IntTree(String s) { overall Root = fromString(s); }

Console IntTree.java:30: error: cannot find symbol System.out.println(new IntTree("[2 [8 [0] null] (1 [7 [4] null] [6 null [9]]]]").evenBranches ()); symbol: method evenBranches Location: class IntTree 1 error