delete object java

Java
Object a = new Object();a = null;// after this,if there is no reference to the object, // it will be deleted by the garbage collector
Source

Also in Java: