int foo;StringStringThatCouldBeANumberOrNot="26263Hello";//will throw exceptionStringStringThatCouldBeANumberOrNot2="26263";//will not throw exceptiontry{ foo =Integer.parseInt(StringThatCouldBeANumberOrNot);}catch(NumberFormatException e){//Will Throw exception!//do something! anything to handle the exception.}try{ foo =Integer.parseInt(StringThatCouldBeANumberOrNot2);}catch(NumberFormatException e){//No problem this time, but still it is good practice to care about exceptions.//Never trust user input :)//Do something! Anything to handle the exception.