dimanche 14 mars 2021

invoke method when I get the parameters like this : Object... args

this is what I need to do:

  • invokes a method that returns an int value, on the given instance.

    • the method to invoke will be given by its name only.
    • You can assume that there is exactly one such method and that
    • the method is declared on the instance itself and not as part of its inheritance chain
    • @param methodName the name of the method to invoke
    • @param args the arguments to pass to the method, if such exists.
    •         Note: You should not use the arguments in order to extract and identify the method.
      
    •               You can do that only (and simply) by its name.
      
    •               You just need to pass the arguments AS IS to the method invocation...
      
    • @return the result returned from the method invocation */

    int invokeMethodThatReturnsInt(String methodName, Object... args);

this is what I did





Aucun commentaire:

Enregistrer un commentaire