Advertisement
fmbalvarez

Guía 2 - Ejercicio 1 + 2 + 3

Mar 24th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1.  
  2. public class Ejercicio1DosYTres {
  3.    
  4.     public double dividir(double a,double b){
  5.        
  6.         // como crear excepcion? metodo main?
  7.        
  8.         double resultado = 0;
  9.        
  10.         try{
  11.             resultado = (a/b);
  12.         } catch (ArithmeticException e){
  13.             System.out.println("No se pudo ejecutar la division");
  14.         } finally{
  15.             System.out.println("El codigo se esta ejecutando");
  16.         }
  17.        
  18.         return resultado;
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement