title: Two Roll Dicer Java object-oriented way
body: <p>Hi I am new to Java OOP and I have some problems in running the program</p>
  
  <p>The problem is there is no output and the loop never stops.</p>
  
  <p>This is my Main.java</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          Dice firstDie = new Dice();
          Dice secondDie = new Dice();
          do {
              count++;
              if(firstDie==secondDie ){
                  same=true;
                  System.out.println("It took "+count+ " times " + firstDie.getValue() + " and " + secondDie.getValue());
              }
          }
          while(!same);
      }
  }
  </code></pre>
  
  <p>and this is my Dice.java </p>
  
  <pre><code>public class Dice {
      private int value;
      public Dice() {
          value = (int)(Math.random()*6)+1;
      } public int getValue() { return value; }
  
  }
  </code></pre>
  
  <p>in my Main.java class when I write int count = 0; and boolean same = false; the loop never ends. </p>