title: Why does my boolean test in java always fail?
body: <p>I am trying to make a boolean test so that if one of the tire pressures is below 35 or over 45 the system outputs "bad inflation".</p>
  
  <p>In my class I must use a boolean, which is what I tried. However the boolean returned is always true. I don't understand why.</p>
  
  <pre><code>public class tirePressure
  {
      private static double getDoubleSystem1 ()  //Private routine to simply read a double in from the command line
      {
          String myInput1 = null; //Store the string that is read form the command line
          double numInput1 = 0;      //Used to store the converted string into an double
          BufferedReader mySystem; //Buffer to store input
          mySystem = new BufferedReader (new InputStreamReader (System.in)); // creates a connection to system files or cmd
          try
          {
              myInput1 = mySystem.readLine (); //reads in data from console
              myInput1 = myInput1.trim (); //trim command cuts off unneccesary inputs
          }
          catch (IOException e)  //checks for errors
          {
              System.out.println ("IOException: " + e);
              return -1;
          }
  
          numInput1 = Double.parseDouble (myInput1); //converts the string to an double
          return numInput1;                       //return double value to main program
      }
  
      static public void main (String[] args)
      {
          double TireFR; //double to store input from console
          double TireFL;
          double TireBR;
          double TireBL;
          boolean goodPressure;
          goodPressure = false;
  
          System.out.println ("Tire Pressure Checker");
          System.out.println (" ");
  
          System.out.print ("Enter pressure of front left tire:");
          TireFL = getDoubleSystem1 ();    //read in an double from the user
  
          if (TireFL &lt; 35 || TireFL &gt; 45)
          {
              System.out.println ("Pressure out of range");
              goodPressure = false;
          }
  
          System.out.print ("Enter pressure of front right tire:");
          TireFR = getDoubleSystem1 ();    //read in an double from the user
  
          if (TireFR &lt; 35 || TireFR &gt; 45)
          {
              System.out.println ("Pressure out of range");
              goodPressure = false;
  
          }
  
          if (TireFL == TireFR)
              System.out.print (" ");
          else
              System.out.println ("Front tire pressures do not match");
          System.out.println (" ");
  
          System.out.print ("Enter pressure of back left tire:");
          TireBL = getDoubleSystem1 ();    //read in an double from the user
  
          if (TireBL &lt; 35 || TireBL &gt; 45)
          {
              System.out.println ("Pressure out of range");
              goodPressure = false;
          }
  
          System.out.print ("Enter pressure of back right tire:");
          TireBR = getDoubleSystem1 ();    //read in an double from the user
  
          if (TireBR &lt; 35 || TireBR &gt; 45)
          {
              System.out.println ("Pressure out of range");
              goodPressure = false;
          }
  
          if (TireBL == TireBR)
              System.out.print (" ");
          else
              System.out.println ("Back tire pressures do not match");
  
          if (goodPressure = true)
              System.out.println ("Inflation is OK.");
          else
              System.out.println ("Inflation is BAD.");
  
          System.out.println (goodPressure);
  
  
      } //mainmethod
  } // tirePressure Class
  </code></pre>