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, Oct 8, 16:57:04

Follow Ups

Reply to Message

Log in


Written & Designed By Ben Graves 1999-2025