vendredi 11 mars 2016

What are the different ways to call methods dynamically in java

Interface:

interface A
{
   void run(String methName);
}

Classs:

class X implements A
{
    void run(String methName)
    {

    }
    void m1()
    {

    }
    void m2()
    {
    }
    void m3()
    {

    }

}

I want to invoke m1, m2 and m3 methods by name dynamically from run method without using reflection mechanism





Aucun commentaire:

Enregistrer un commentaire