title: My loop won't let me enter user input to end the loop :( (java)
body: <p>Ok, so basically, I linked all my methods up, everything is looking good (through my nooby eyes). I have a loop and question whether the user wants to continue. I initially had a if else statement based on a y/n input. If n is entered, I use a break; statement. However, I initialize the scanner and the print statement in the line where I comment //THIS DOESN'T WORK. Why won't it let me enter something once I type that? </p>
  
  <p>Main Class</p>
  
  <hr>
  
  <pre><code>import java.util.Scanner;
  public class Triangle
  {
      public static void main (String[]args)  
      {
          Scanner input = new Scanner(System.in);
          int x, y, z;
          for (int loop = 1; loop &lt;= Integer.MAX_VALUE; loop++)
          {
              System.out.println("Please enter the 3 sides of the triangle.");
              x = input.nextInt();
              y = input.nextInt();
              z = input.nextInt();
              boolean goAgain;
              String userInput;
  
              TriMethods triTest = new TriMethods(x, y, z);
  
              System.out.println("You entered a triangle with the sides " + triTest.toString() + ": ");
  
              triTest.isEqual();
              triTest.isIsos();
              triTest.isScal();
  
              System.out.println("Would you like to go again? y/n");
  
              String answer = userInput.nextLine(); //THIS DOESN'T WORK
  
          }
      }
  }
  </code></pre>
  
  <p>Second Class</p>
  
  <hr>
  
  <pre><code>public class TriMethods {
  
      int side1;
      int side2;
      int side3;
  
      public TriMethods(int x, int y, int z)
      {
          side1 = x;
          side2 = y;
          side3 = z;
      }
  
      public int longSide()
      {
          int longSide = side1;
  
          if (side2 &gt;= longSide &amp;&amp; side2 &gt;= side3)
          {
              longSide = side2;
          }
          else if (side3 &gt;= side2 &amp;&amp; side3 &gt;= side2)
          {
              longSide = side3;
          }
          return longSide;
      }
  
      public void shortSide()
      {
          int shortSide = side1;
  
          if (side2 &lt;= shortSide &amp;&amp; side2 &lt;= side3)
          {
              shortSide = side2;
          }
          else if (side3 &lt;= side2 &amp;&amp; side3 &lt;= side2)
          {
              shortSide = side3;
          }
  
          System.out.println("The long side is " + shortSide);
      }
  
      public void isEqual()
      {
          if (side1 == side2 &amp;&amp; side1 == side3 &amp;&amp; side2 == side3)
          {
              System.out.println("This triangle is equalateral");     
          }
      }
  
      public void isIsos()
      {
          if (side1 == side2 &amp;&amp; side1 != side3)
          {
              System.out.println("This triangle is isosceles");
          }
          else if (side1 == side3 &amp;&amp; side1 != side2)
          {
              System.out.println("This triangle is isosceles");
          }
          else if (side2 == side1 &amp;&amp; side2 != side3)
          {
              System.out.println("This triangle is isosceles");
          }
          else if (side2 == side3 &amp;&amp; side2 != side1)
          {
              System.out.println("This triangle is isosceles");
          }
      }
  
      public void isScal()
      {
          if (side1 != side2 &amp;&amp; side1 != side3 &amp;&amp; side2 != side3)
          {
              System.out.println("This triangle is scalene");
          }
      }
  
      public String toString()
      {
          return (side1 + " " + side2 + " " + side3);
      }
  
  }
  </code></pre>