What method in Java is used to destroy your objects [closed]

Sorry, but there isn’t really a “free” or “dispose” equivalent in Java.

The best you can do is just set the object to null (removes the reference). Then explicitly tell the garbage collector you’re going rambo (its somewhere in java.lang.Runtime).

Leave a Comment