title: How to make JAVA method that accepts any object as parameter?
body: <p>Suppose i have a project with many objects of different kinds, but they all have an instance variable X, how do i make a method that accepts an object of any type, and returns X?</p>
  
  <p>Dummy code example:</p>
  
  <pre><code>class Car{
  int X =19;
  }
  class Apple{
  int X =21;
  }
  class Bee{
  int X =32;
  }
  public int GetX(Object ANY_OBJECT_HERE){
  return ANY_OBJECT_HERE.X;
  }
  </code></pre>