Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Is the Java Compiler retarded?

Name: Anonymous 2009-10-27 3:15

Its telling me I need a return statement on the last line of my method even though that part can never be executed.. I am a novice at Java and I am teaching myself.. so is it just me that has bad coding style or is the java compiler a bit too OCD?

Name: Anonymous 2009-10-27 19:10

THIS IS ENTERPRISE QUALITY!

Non-ENTERPRISE way:

public static String translate(String[] sourceLanguage, String[] destinationLanguage, String toBeTranslated)
{   
    for (int i = 0; i < (sourceLanguage.length); i++)
    {   
        if (toBeTranslated.equals(sourceLanguage[i]))
            return (destinationLanguage[i]);                          
    }

    return ("?????");
}


Please don't post on /prog/ anymore (and remember to email all your posts to sage for the quickest answers!).  Thanks!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List