Friday 9 May 2014

Textual description of firstImageUrl

Out Of Memory Error In Java

A Simple Example of creating Out Of Memory Error in a Java Program . It is an Error , so you can catch it also .
import java.util.*;


public class OutOfMemoryTest
{
 public static void main(String[] args)
 {
  try
  {
   LinkedList list = new LinkedList();
   while(true)
   {
    list.add(new Object());
   }
  }
  catch(Throwable e)
  {
   System.out.println("caught it ");
  }
  
  
 }
}