/* Time:
2012-10-10
Author:
Smoke large
program requirements:
familiar with the exception handling mechanism;
Try
{
The code that may appear to be abnormal;
}
catch
{
actions to handle exceptions;
}
finally {The
action that must be performed;
}
Program Explanation:
First: Write the code for the input, In the previous example, we have also given example
two: Write try{}catch{}finally{} 's internal code part
three: Finally through the value of I to judge the abnormal output operation/
import java.io .*;
Class Day1010_exception
{public
static void Main (string[] args) throws IOException
{
String name;
int i=0;
Try
{
BufferedReader b;
B=new BufferedReader (New InputStreamReader (system.in));
Name=b.readline ();
Name=args[0];
System.out.println ("Dear" +name+) hello. ");
i=0;
}
catch (arrayindexoutofboundsexception e)
{
i=1;
}
Finally
{
if (i==1)
{
System.out.println ("Please enter a name.) ");
}
}
}
}