I am trying to understand how reflection works, i cant able to figure out the problem. In the second for loop method.length is not fetching method from another program.
Following is the code:
public class DriverScript 
{
    public static ActionKeywords actionKeywords;
    public static String sActionKeyword;
    public static Method method[];
    public DriverScript() throws NoSuchMethodException, SecurityException 
    {
        actionKeywords = new ActionKeywords();
        method = actionKeywords.getClass().getMethods();
    }
    public static void main(String[] args) throws Exception 
    {
        System.out.println(method);
        String sPath = "C:\\Users\\mag6\\Desktop\\toolsqa.xlsx";
        ExcelUtils.setExcelFile(sPath, "Test Steps");
        for (int iRow = 1; iRow <= 9; iRow++) 
        {
            sActionKeyword = ExcelUtils.getCellData(iRow, 3);
            execute_Actions();
        }
    }
    private static void execute_Actions() throws Exception 
    {
        for (int i = 0; i < 11; i++) 
        {
            if (method[i].getName().equals(sActionKeyword)) 
            {
                method[i].invoke(actionKeywords);
                break;
            }
        }
    }
}
 
     
     
     
    