<ubb>
public class examprep
{
public void first() throws Exception
{
System.out.println("Inside the first method!!");
throw new Exception();
}
public void second() throws AWTException
{
try
{
System.out.println("Inside try block of the second method!!");
first();
}
catch(Exception ex)
{
System.out.println("Inside Exception catch block of second method!!");
throw (AWTException)ex;
}
}
public static void main(
String[] args)
{
examprep ep = new examprep();
try{
ep.second();
}
catch(AWTException ee)
{
System.out.println("Catch block of main method");
}
}
}
</ubb>
----------------------------
When I ran the code (Which i collected from browsing ranch and picked up from old
thread) above on my jdk1.2.2 in Win 98, my compiler complains that
class AWTException not found in throws..
class AWTException not found etc.,
But there was a long discussion about the run-time casting of the Exceptions in this program. I haven't got head or tail of it.
Please help.
How to interpret this code.
Do we get such complicated codes in the real exam.
Is there any standard way to proceed through the lengthy code keeping track of all references/ variables etc.,
Help is greatly appreciated. Iam giving the exam in monthend.
regards.
tvs sundaram