Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ejemplo;
- public class Ejemplo1 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int j = 0;
- String cadena = null;
- try {
- System.out.println("Longitud de la cadena "+cadena.length());
- j = 1/j;
- System.out.println("Pasamos por la división");
- } catch (ArithmeticException e) {
- System.out.println("Capturamos el error de la división");
- } catch (NullPointerException e) {
- System.out.println("Exception Null");
- } catch (Exception e) {
- System.out.println("Exception ");
- } finally {
- try {
- System.out.println("Longitud de la cadena "+cadena.length());
- } catch (Exception e) {
- System.out.println("Exception 2 Null");
- }
- System.out.println("Reto Cumplido!");
- }
- System.out.println("Seguimos con el Programa");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement