title: why am i getting zero while i have initialized my instance variables?
body: <p>i have a simple java program below. i have declared instance integer variable "x1" and "x2", initialize them from parameters in my class constructor.
  i have also declared an integer variable "diff" that works out the difference between "x1" and "x2" but the variable returns zero!! i don't know where the problem is and my constructor parameters are not zero!!!. i will appreciate any help</p>
  
  <pre><code>public class Smallest {
  int x1;
  int x2; 
  
  public Smallest(int a,int b){
   this.x1=a;
   this.x2=b;
  }
  
  int diff = x2 - x1;   
  public void draw(){
      System.out.println("X1= "+ x1 +"\n X2= "+ x2 +"\n diff= " +diff);
  }
  
  public static void main(String[] args) {
  Smallest small=new Smallest(10,20);
  small.draw();
  }
  }
  </code></pre>
  
  <p>here's the output</p>
  
  <pre><code> X1= 10;
   X2= 20;
   diff= 0;
  </code></pre>