title: Storing and accessing objects in a class without a instance reference
body: <p>I know in C# this is okay to do but what about in Java? I have tested it and it works but should it be avoided and if so, why?</p>
  
  <pre><code>public class A {
       public A() {
            B.set(this);
       }
  }
  
  public final class B {
       private static A a;
  
       public static void set(A a) {
            this.a = a;
       }
  
       public static A get() {
            return a;
       }
  
       private B() {
       }
  }
  </code></pre>