Defaulting to last part of else if statement in java : <p>I am writhing a code to find the distance between 2 places where the user inputs different cities. i need to get the longitude and latitude of the two places, so i tried writing the code like this, but for some reason that i do not know, it always uses the coordinantes for orlando no matter what. Could anyone please help me?</p>

<p>(The latitudeStringOfQ is what the user entered)</p>

<pre><code>if (latitudeStringOfQ.equals(city1))
        {
            latitudeOfQ = latitudeOfBarrow;
            longitudeOfQ = longitudeOfBarrow;
        }
        else if (latitudeStringOfQ.equals(city2))
        {
            latitudeOfQ = latitudeOfBrisbane;
            longitudeOfQ = longitudeOfBrisbane;
        }
        else if (latitudeStringOfQ.equals(city3))
        {
            latitudeOfQ = latitudeOfDuluth;
            longitudeOfQ = longitudeOfDuluth;
        }
        else if (latitudeStringOfQ.equals(city4))
        {
            latitudeOfQ = latitudeOfLondon;
            longitudeOfQ = longitudeOfLondon;
        }
        else if(latitudeStringOfQ.equals(city5));
        {
            latitudeOfQ = latitudeOfOrlando;
            longitudeOfQ = longitudeOfOrlando;
        }
System.out.print(latitudeOfQ);
System.out.print(longitudeQ);
</code></pre>
