The return of the root method gives me an error and I do not know what it should be
import java.util.Scanner;
public class RaizCuadrada {
private int numero;
//CONSTRUCTORES
public RaizCuadrada(){
System.out.println("Inroduce un numero: ");
Scanner sc = new Scanner(System.in);
numero=sc.nextInt();
sc.close();
}
//SET AND GET
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
//METODOS
public double raiz() {
double respuesta;
if(numero > 0) {
respuesta = Math.sqrt(numero);
}else {
System.out.println("El numero introducido es negativo");
}
return respuesta;
}
}