i want to pass an integer value as an input, for that first i have to get the value as an string and then convert it into an Integer. i wrote the code and it looked like this ..
String age="";
int intage=0;
System.out.print("Please Enter your age : ");
try{
age= dataIn.readLine();
intage=Integer.parseInt(age);
}catch( IOException e ){
e.printStackTrace();
}
but my problem here is that when i enter a String like "dfjdkdjre" , as input , i get an error or rather an exeption.. how do i prevent this ... can i display an error message or ??
can some one help me complete my code .. please :(
and could some one tell me what does this line do...
e.printStackTrace();
please help me .. i am kind of lost in this :(