Wikia

Programmer's Wiki

Throw an exception

Talk0
385pages on
this wiki
Exceptions allow you to send a warning message to any programs that may be using your class. This allows the program to catch the Exception and deal with the problem.

Java Edit

public void riskyTask() throws Exception{
	if(somethingBad == true) {
		Throw new Exception();
	}
}

the throws Exception warns anyone using this method to deal with the exception it might throw.

Advertisement | Your ad here

Photos

Add a Photo
28photos on this wiki
See all photos >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki