5
I want to create a divide method (double a, double b) that has Try/catch to catch the Arithmetic Exception, returning an error message by System.out.println; as it is not in the main method, I do not know how it has to be the signature of the method, return, etc. I needed something like this:
public static ? divide(double dividendo, double divisor){
try{
return dividendo/divisor;
}
catch(ArithmeticException e){
System.out.println("Erro: divisão por zero!");
}
}
Can leave the return as double even
public static double divide
– Wellington Avelino