title: My Java program is testing if integer is divisible by 3 or 5, but is just printing every integer, how do I fix it?
body: <p>I am not getting errors at all in my code but it is NOT doing what I want it to - at all. I understand that there is <a href="https://stackoverflow.com/questions/31106668/find-if-a-number-is-divisible-by-3-or-5-fizzbuzz">another question related to divisibility to 3 or 5</a> but I do not think the question relates, as our coding is built completely different. I also find that <a href="https://stackoverflow.com/questions/26700089/java-program-that-prints-out-numbers-that-are-divisible-by-other-numbers">this answer</a>, <a href="https://stackoverflow.com/questions/26675725/java-programming-divisibility-and-counting">this other answer</a>, <a href="https://stackoverflow.com/questions/13792435/java-program-divisibility-test-with-varification-how-do-i-write-this-in-text">or even this answer</a> are not helping me, either.</p>
  
  <p>Anyway, I am trying to use a simple boolean expression to determine if an expression is true or not, then if it is true or not printing different lines. The intended look I would get is something like:</p>
  
  <pre><code>3 is divisible by 3
  3 is not divisible by 5
  4 is not divisible by 3
  4 is not divisible by 5
  5 is not divisible by 3
  5 is divisible by 5
  and so on...
  </code></pre>
  
  <p>However, I'm getting this:</p>
  
  <pre><code>3 is divisible by 3
  3 is not divisible by 3
  3 is divisible by 5
  3 is not divisible by 5
  and so on...
  </code></pre>
  
  <p>Initial problem can be found <a href="https://projecteuler.net/problem=1" rel="nofollow noreferrer">here.</a> Right now I am just experimenting with the code, trying to get myself to a better understanding of Java. I wanted to start by knowing how to separate integers that are divisible by the numbers from integers that are not divisible by the numbers and I figured the best way to test this was to print the lines out. I do not know if I am going in the right direction at ALL here. Can anyone either give me pointers on the current code I have, or some hints, such as links to the corresponding Java commands that I will have to use for this program to work. If you post code that works, so I can see what I should be doing, that is fine too but please explain it to me, then. I don't want to just know what to type, I am trying to develop a solid foundation of programming problem-solving.</p>
  
  <p>Sorry if this is a terrible question, I am EXTREMELY new to programming in general and am completely self-teaching. Give me some pointers, and I can most definitely change the question!</p>
  
  <pre><code>package multiplesof3and5;
  
  public class InitialProgram {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          int integer1;
          integer1 = 0;
          boolean divisibleby3 = (integer1 % 3) == 0;
          boolean divisibleby5 = (integer1 % 5) == 0;
  
             for( integer1=0; integer1&lt;1000; integer1++){
              if(divisibleby3 = true);{
                  System.out.println(integer1 + " can be divided by 3");} 
              if(divisibleby3 = false);{
                  System.out.println(integer1 + " cannot be divided by 3");}
              if(divisibleby5 = true);{
                  System.out.println(integer1 + " can be divided by 5");}
              if(divisibleby5 = false);{
                  System.out.println(integer1 + " cannot be divided by 5");
              }
  
          }
  
  
  
      }   
  }
  </code></pre>