Tree java

Reply

Join Date: Oct 2009
Posts: 16
Reputation: TigerGirl is an unknown quantity at this point 
Solved Threads: 0
TigerGirl TigerGirl is offline Offline
Newbie Poster

Tree java

 
0
  #1
26 Days Ago
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.
  1. int newWord = 0;
  2. int word = d.wordToHere.length();
  3. if(word > newWord){
  4. newWord = word;
  5. return longestWord((Node) d.children);
  6. }
  7. else{
  8. return longestWord( (Node) d.children);
  9. }
Last edited by TigerGirl; 26 Days Ago at 3:21 am. Reason: need to add more details
Reply With Quote Quick reply to this message  
Reply

Tags
java, tree

Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC