12.10 (OutOfMemoryError)
Write a program that causes the JVM to throw an OutOfMemoryError and
catches and handles this error.
Write a program that causes the JVM to throw an OutOfMemoryError and
catches and handles this error.
public class Exercise_10 { public static void main(String[] args) { try { int[] temp = new int[1000000000]; temp = new int[temp.length * 1000000000]; } catch (OutOfMemoryError ex) { ex.printStackTrace(); } } }
No comments :
Post a Comment