10.11.2014 Views

Exception Handling in Java

Exception Handling in Java

Exception Handling in Java

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How is the exception handled?<br />

• ignore it<br />

• handle it where it occurs<br />

• handle it an another place <strong>in</strong> the program<br />

<strong>Exception</strong>: Ignore It<br />

The program will term<strong>in</strong>ate and produce an appropriate message.<br />

public class Zero {<br />

public static void ma<strong>in</strong> (Str<strong>in</strong>g[] args) {<br />

<strong>in</strong>t numerator = 10;<br />

<strong>in</strong>t denom<strong>in</strong>ator = 0;<br />

System.out.pr<strong>in</strong>tln (numerator / denom<strong>in</strong>ator);<br />

System.out.pr<strong>in</strong>tln ("This text will not be pr<strong>in</strong>ted.");<br />

}<br />

}<br />

2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!