GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  OOPS

 Print  |  
Question:  How can i call a funtion,given its name as string?



March 03, 2008 05:03:11 #5
 sampra J2EE Expert  Member Since: February 2008    Total Comments: 279 

RE: How can i call a funtion,given its name as string?
 
Class clsObj = Class.forName("ClassName");
   Method method = clsObj.getMethod("methodName",null);
   method.invoke(clsObj.newInstance(),null);
     

 

Back To Question