How to print different Messge for the same NumberFormatException on different cause objects in JAVA?

How to print different Messge for the same NumberFormatException on different cause objects in JAVA?

How to print different Messge for the same NumberFormatException on different cause objects in JAVA?

try { int a=Integer.parseInt(aStr); int b= Integer.parseInt(bStr); }catch (NumberFormatException ex) { if ex's cause is from int a;//ex.getCause()=a? System.out.println("a is not a integer"); if ex's cause is from int b System.out.println("b is not a integer"); }

or 2 catch block, but how to complete it?

try { int a=Integer.parseInt(aStr); int b= Integer.parseInt(bStr); }catch (NumberFormatException ex) { if ex's cause is from int a;//ex.getCause()=a? System.out.println("a is not a integer");} catch (NumberFormatException ex){ if ex's cause is from int b System.out.println("b is not a integer"); } .

View Answers

Ads









Related Tutorials/Questions & Answers:
How to print different Messge for the same NumberFormatException on different cause objects in JAVA?
login for different user in the same page
Advertisements
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet
how to get values for same column name from two different tables in SQL
inserting same data to different tables in oracle
inserting same data to different tables in oracle
inserting same data to different tables in oracle
inserting same data to different tables in oracle
inserting same data to different tables in oracle
inserting same data to different tables in oracle
different output trying to execute same java code
different output trying to execute same java code
different output trying to execute same java code
How to make a button of different behaviour?
How create an overlay button on different containing div
updating rows which contains same id, different value for each row
How to Explain different way of using thread?
How to communicate with different web applications ? ? ? ? - JSP-Servlet
How to Explain different way of using thread?
Different JRE
how to store array values into two different tables in java?
How to read text file to two different name array
How to read text file to two different name array
Updating rows who has same id with different values for each row from java program
Class and interface in same file and accessing the class from a main class in different package
Class and interface in same file and accessing the class from a main class in different package
DIFFERENT PAGES FOR DIFFERENT USERS ACCORDING TO THEIR ROLE
How to close a frame on action event of a button from a different class ?
Different between getRequestParameterMap() and getRequestParameterValuesMap()
java program of different shapes
What are the different types of AutoProxying?

Ads