title: Decoupling 3rd party code from application in java
body: <p>I have an application that uses 3rd party (external jars) and there are all over the place. 
  say for example I have a method f in some class </p>
  
  <pre><code>public int f(int x){
  Y y = new Y(x);
  return y.someCalculations();
  }
  </code></pre>
  
  <p>where Y is a class from 3rd party.</p>
  
  <p>Say I want to move to other 3rd party? or make my own implementation of Y how can I decouple the dependence in such a way that I can use any 3rd party I want in the future with no effort.</p>
  
  <p>Thank u in advance</p>