title: I'm having trouble with a loop, my error involving &&
body: <p>My directions are to write a code (in java) that finds an code between 1,000 and 9,999 (any 4 digit number), that meets four qualifications:</p>
  
  <ol>
  <li>All four digits are different.</li>
  <li>The digit in the thousands place is 3 times the digit in the tens place.</li>
  <li>The number is odd.</li>
  <li>The sum of the digits is 27.</li>
  </ol>
  
  <p>This is what I have so far. I'm getting an error under my <code>//loop</code> section:</p>
  
  <pre><code>C4PP10.java:27: error: bad operand types for binary operator '&amp;&amp;'"
  </code></pre>
  
  <p>is the error that appears.</p>
  
  <p>In my head, <code>&amp;&amp;</code> simply means "and", am I using it improperly?</p>
  
  <p>This is for my intro to java class homework BTW.</p>
  
  <pre><code>public class C4PP10
  {
      public static void main(String[] args)
      {
          //variables
          int first=1;
          int second=0;
          int third=0;
          int fourth=0;
          int total = first * 1000 + second * 100 + third * 10 + fourth;
          boolean fourDifferentDigits = false;
          boolean thousandsPlaceX3TensPlace = false;
          boolean odd = false;
          boolean sum = false;
          boolean correctAddress = false;
  
          //loop
          while (correctAddress = false)
          {
              fourth = fourth + 1;
              if (fourth == 10)
              {
                  fourth = 0 &amp;&amp; third = third + 1;
              }//end if
              if (third == 10)
              {
                  third = 0 &amp;&amp; second = second + 1;
              }//end if
              if (second == 10)
              {
                  second = 0 &amp;&amp; first = first + 1;
                  total = first * 1000 + second * 100 + third * 10 + fourth;
              }//end if
          }//end loop
  
  
          //testing
          if ( first != second &amp;&amp; first !=third &amp;&amp; first !=fourth &amp;&amp; second !=third &amp;&amp;                 second !=fourth &amp;&amp; third != fourth )
          {
              fourDifferentDigits = true;
          }//end if
  
          if (first == third*3)
          {
              thousandsPlaceX3TensPlace = true;
          }//end if 
  
          if (fourth%2 != 0)
          {
              odd = true;
          }//end if
  
          if ( first + second + third + fourth == 27 )
          {
              sum = true;
          }//end if
  
          if (fourDifferentDigits=true &amp;&amp; thousandsPlaceX3TensPlace=true &amp;&amp; odd=true   &amp;&amp; sum=true)
          {
              correctAddress = true;
          }//end if
  
          if (correctAddress = true)
          {
              System.out.println("The Riddler plans to strike " + total + " Pennsylvania     Avenue!");
          }
  
      }//end main
  }//end class
  </code></pre>