Compile Error variable not initialized : <p>I've written program here to prompt a user for 3 integer variables compare them and find out which one is the largest middle and smallest, that part works fine. My issue is if you look at my first if statement I am trying to save those values each into a variable in memory, I keep getting variables not initialized errors. Any help would be great! I am basically wanting to store those values to continue writing more code to compare them and find out if they create a triangle or not. </p>

<pre><code>import java.util.Scanner;
    public class TriangleProgram
    {
       public static void main(String [] args)
       {
          Scanner input = new Scanner(System.in);

          int x;
          System.out.print("Enter X: ");
          x = input.nextInt();

          int y;
          System.out.print("Enter Y: ");
          y = input.nextInt();

          int z;
          System.out.print("Enter Z: ");
          z = input.nextInt();

          System.out.println();

          int largest;
          int middle;
          int smallest;


          if(x &gt; y &amp;&amp; x &gt; z &amp;&amp; y &gt; z)
          {
             System.out.println("Largeset Number: " + x);
             System.out.println("Middle Number: " + y);
             System.out.println("Smallest Number: " + z);

             x = largest;
             y = middle;
             z = smallest;

          }

          else if(x &gt; y &amp;&amp; x &gt; z &amp;&amp; z &gt; y)
          {
            System.out.println("Largeset Number: " + x);
            System.out.println("Middle Number: " + z);
            System.out.println("Smallest Number: " + y);
          }

          else if(y &gt; x &amp;&amp; y &gt; z &amp;&amp; x &gt; z)
          {
            System.out.println("Largeset Number: " + y);
            System.out.println("Middle Number: " + x);
            System.out.println("Smallest Number: " + z);
          }

          else if(y &gt; x &amp;&amp; y &gt; z &amp;&amp; z &gt; x)
          {
            System.out.println("Largeset Number: " + y);
            System.out.println("Middle Number: " + z);
            System.out.println("Smallest Number: " + x); 
          }

          else if(z &gt; x &amp;&amp; z &gt; y &amp;&amp; x &gt; y)
          {
            System.out.println("Largeset Number: " + z);
            System.out.println("Middle Number: " + x);
            System.out.println("Smallest Number: " + y);
          }

          else
          {
            System.out.println("Largeset Number: " + z);
            System.out.println("Middle Number: " + y);
            System.out.println("Smallest Number: " + x);
          }


       }
    }
</code></pre>
