how can i solve it`NumberFormatException:
public class Maria {
public static void main(String[] args) {
String datoLeido="";
String datoAux=null;
int datoConvertido;
Scanner teclado=new Scanner(System.in);
System.out.println(" Favor de ingresar el nombre");
datoLeido=teclado.nextLine();
if(datoLeido.length()>2)
datoAux="Hola"+datoLeido;
int Longuitud=datoAux.length();
datoConvertido=Integer.parseInt(datoAux);
System.out.println(datoAux);
}
}
my teacher asked me to solve two errors with exceptions, how can I do it.. this error appears: Exception in thread "main" java.lang.NumberFormatException: For input string: "Holaangel" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at maria.Maria.main(Maria.java:29)