Home » JAVA Programming » Java Basic » Question
  1. What does foo.getClass().getMethod(“doSomething”, null) return?
    1. Exception is thrown
    2. Class object
    3. Method is returned and we can call the method as method.invoke(foo,null);
    4. doSomething method instance
    5. None of these
Correct Option: C

foo.getClass().getMethod() returns a method and we can call the method using method.invoke();



Your comments will be displayed only after manual approval.