>>6
Here it is:
public static String translate(String[] sourceLanguage, String[] destinationLanguage, String toBeTranslated){
int i;
//assume the word to be translated is not translatable,
boolean isTranslatable = false;
//check every word in the sourceLanguage array for that word.
for (i = 0; i < (sourceLanguage.length); i++){
//If it is there conclude that it can be translated and hence return it's equivalent
if (toBeTranslated.equals(sourceLanguage
[i])){
isTranslatable = true;
return (destinationLanguage
[i]);
}
}
//if it still is not translatable, return "?????" to show confusion.
if (isTranslatable == false){
return ("?????");
}
return "This is dead code anyway";//the javac insisted on this..
}