Moral Story: The Jigsaw Puzzle

There was a man who had the habit of reading the newspaper in the morning. He would do anything else only after reading the entire newspaper. One morning while he was reading the news columns, his six year old daughter was insisting that he play with her. The Father was interrupted by the child’s actions. He saw a full page advertisement of a courier company with the world map on it. Instantly the father tore the advertisement into pieces from the paper. He scattered the…

Continue reading »

Garbage Collector in Java

Java is capable of automatically releasing the unreferenced memory. This is achieved when a object is unused. To make a object unused make the reference variable pointing to that object as null pointer. Lets see an Example below, public void TestMethod() { String s = new String(“Welcome to CodeParent”); System.out.println(s); s = null; } Other options in java you can use System.gc() and Runtime.gc() methods, if you call these methods explicitly, the JVM makes efforts towards recycling the unused objects, but there is no guarantee…

Continue reading »