Monday, 13 February 2017

UnCheckedException : NoSuchMethodExcept




public class NoSuchMethodExcept {

    public NoSuchMethodExcept()
    {
        Class c;        try        {
            c = Class.forName("java.lang.String");            try            {
                Class[] paramTypes = new Class[5];                Method m = c.getDeclaredMethod("fooMethod", paramTypes);            }
            catch (SecurityException e)
            {
                e.printStackTrace();            }
            catch (NoSuchMethodException e)
            {
                e.printStackTrace();            }
        }
        catch (ClassNotFoundException e)
        {
            // deal with the exception here ...            e.printStackTrace();        }
    }

    public static void main(String[] args)
    {
        new NoSuchMethodExcept();    }

}

No comments:

Post a Comment