Hello I am trying to read a node that will find the longest word in a tree. So, my method is a public static int word(Node d) So how would I have to find the length of that node? Would I just use the string that was made in the class? Like I don't know how I would read the node. Its in a public class where it has a boolean, String , and children. So, this is what I have.
int newWord = 0;
int word = d.wordToHere.length();
if(word > newWord){
newWord = word;
return longestWord((Node) d.children);
}
else{
return longestWord( (Node) d.children);
}