I have 3 class A , B , C and they have Some method and in main I have
A x = new A();
B y = new B();
C z = new C();
I have two String String1 , String2 how I can call method "String2" that is in object "String1" (call "String1"."String2") I try these ways
Class a = Class.forName("class name"); //I have Object name
ClassName.class.getMethods(...).invoke(...); //It's useful when i have the class name
please help me
Aucun commentaire:
Enregistrer un commentaire