Beginning Java : Finding the greatest number out of a list
<p>I am trying to write a code that prompts the user for three numbers and the program is supposed to say what number is the greatest. I didn't want to do a bunch of "System.out.print" in the if and else if statements. The error according to the debugger is that "greatest" and "greatest1" have not been initialized. </p>

<pre><code>import java.util.Scanner;

public class number1
{

    public static void main(String[] args)
    {

        double a, b, c;
        double greatest, greatest1;

        Scanner keyboard = new Scanner(System.in);
        System.out.print("Enter one number :");
        a  = keyboard.nextDouble();
        System.out.print("Enter another number :"); 
        b  = keyboard.nextDouble();
        System.out.print("Enter a third number :");
        c  = keyboard.nextDouble();

        if(a &gt; b &amp;&amp; a &gt; c) {
            greatest = a;
        } //end of if statement

        else if(b &gt; a &amp;&amp; b &gt; c){   
            greatest = b;
        }

        else if(c &gt; a &amp;&amp; c &gt; b) { 
            greatest = c;
        }
        else if(a==b &amp;&amp; c &lt; a) {
            greatest = a;
            greatest1 = b;

        }

        else if(a==c &amp;&amp; b &lt; a) {
            greatest = a;
            greatest1 = c;
        }

        else if(b==c &amp;&amp; a &lt; b) {
            greatest = b;
            greatest1 = c;
        }

        else {
            System.out.print("All of the numbers are greatest");
        }
        System.out.print("The greatest number is: " +greatest+ "and" +greatest1);
    }
} 
</code></pre>
