Curso de Verão de Java



Exceções - Exceções Levantadas pelo Runtime de Java

ArithmeticException (divisão de inteiro por zero)

	class Arith {	
		public static void main (String args[]) { 	
			int j = 0;	
			j = j / j;	
		}	
	}	
	
NullPointerException

	class Null {	
		public static void main (String args[]) {	
			String o = null;
			int a[] = null;	
			o.length();	
			a[0] = 0;	
		}	
	}	
	
IncompatibleClassChangeException

ClassCastException

	class ClassCast {	
		public static void main (String args[]) { 
			Object o = new Object();	
			String s = (String) o;	
			s.length(); 	
		}	
	}	
NegativeArraySizeException

OutOfMemoryException

NoClassDefFoundException

	class NoClass {	
		public static void main (String args[]) { 	
			C c = new C();	
		}	
	}	
ArrayIndexOutOfBoundsException

UnsatisfiedLinkException

InternalException


Breno Gustavo Soares da Costa, bgsc@di.ufpe.br
Última edição em 22 de janeiro de 1996.
URL: http://www.di.ufpe.br/~java/verao/aula8/levantad.html