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









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?
updating rows which contains same id, different value for each row
how to communicate with different web applications - JSP-Servlet
How to communicate with different web applications ? ? ? ? - JSP-Servlet
How create an overlay button on different containing div
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?
* How to communicate with different web applications ? ? ? ? - JSP-Servlet
*** How to communicate with different web applications ? ? ? ? - JSP-Servlet
Different JRE
difference between java5 and java6 - Java Beginners
how to store array values into two different tables in java?
Updating rows who has same id with different values for each row from java program
links with different colors.
How to resolve NumberFormatException(Unlnown Source)?
How to read text file to two different name array
How to read text file to two different name array
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 kinds of actions in Struts
different JDBC drivers available
DIFFERENT PAGES FOR DIFFERENT USERS ACCORDING TO THEIR ROLE
Java2
PHP Comparison Objects
how to mark different colors for diffent rows - Java Beginners
How to close a frame on action event of a button from a different class ?
What are the different types of AutoProxying?
Different between getRequestParameterMap() and getRequestParameterValuesMap()
java program of different shapes
ftech different value corresponding different value
PHP related - how to explot a string with commas and store into two different variables?
PHP search data with different format
how to mark different colors for diffent rows - Java Beginners
JTable hold different components
python print on same line in loop
jasper report display in different formats

Ads