As the Java JVM's GC is a tracing and mark-and-sweep garbage collector, not a reference counter, it's impossible to cause a memory leak in Java purely through circular references.
The reason for this is that A will reference B, B will reference A, but no other objects will reference A or B, therefore marking both A and B (during the mark phase) eligible for garbage collection.
The JVM's GC marks all objects in the heap as collectable, traces from its roots, such as static variables, classloaders and such, marks all objects reachable by this trace as not-collectable and therefore would never reach the A or B instance you allocated. Therefore, the JVM's GC will detect that A and B are eligible for garbage collection and reclaim their memory.