944,127 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 968
  • Java RSS
Oct 31st, 2009
0

Tree java

Expand Post »
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.
Java Syntax (Toggle Plain Text)
  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; Oct 31st, 2009 at 3:21 am. Reason: need to add more details
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TigerGirl is offline Offline
19 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: can I make link on scroll text in a swing java
Next Thread in Java Forum Timeline: Expression Trees





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC