- package istak.org;
- public class Main
- {
- public static void main(String args[])
- {
-
-
- String num1="100";
- String num2="A";
- int total=0;
- try
- {
- total=Integer.parseInt(num1)+Integer.parseInt(num2);
- System.out.println(total);
- }
- catch(Exception ex)
- {
- num2="30";
- total=Integer.parseInt(num1)+Integer.parseInt(num2);
- System.out.println(total);
- }
- finally
- {
- total+=100;
- System.out.println(total);
-
-
- }
- }
- }
複製代碼 |