// Use of exceptions , try , catch and finally clause

public class ExceptionA
{
	public static void main (String args[])
	{
		try 
		{
			throwE1(); // call method
		}
		
		catch (Exception e) // classExpression name ref
		{
			System.err.println("Exception in main method handled"); // message using.err
		}

		keepThrowE1(); // call method
	}

	public static void throwE1() throws Exception
	{
		try
		{
			System.out.println("The method throwE1 throws exception ");
			throw new Exception(); // throw exception 
		}

		catch (Exception e )//Classexception name ref - catch exception 
		{
			System.err.println("Exception handled in throwE1");
			throw e;
		}

		finally
		{
			System.err.println("Exception is handled");
		}

	}

	public static void keepThrowE1()
	{
		try
		{
			System.out.println("The method does not throw an exception");
		}

		catch (Exception e)
		{
			System.err.println(e.toString()); // return string method (double , float string)
		}

		finally
		{
			System.err.println("Exception dealt");
		}

		System.out.println("Test complete");
	}

}