Anyone take a look at peice of code for me?

Been an age since I've used Java. The following code will not compile as it says it's not giving a result of type string.

public String getDetails(String word)
{
if (dictionary.containsKey(word))
{
Word w = dictionary.get(word);
ArrayList meanings = w.getElements();
for (int i =0; i < meanings.size(); i++)
{
// iterates through array list, giving details of word
String details = (String)meanings.get(i);
return details;
}
}
else
{
// do nothing
}
}

Posted By: Steve on October 8th 2007 at 16:57:04


Message Thread


Reply to Message

In order to add a post to the WotB Message Board you must be a registered WotB user.

If you are not yet registered then please visit the registration page. You should ensure that their browser is setup to accept cookies.

Log in