We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Right now, you are casting your method to a String when a method isn't really a String. If you check out the documentation, http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html, you can see that a function called "getName()" can be called on an instance of Method and it returns a string with the name of the method. That's what we want.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Reflection - Attributes
You are viewing a single comment's thread. Return to all comments →
Right now, you are casting your method to a String when a method isn't really a String. If you check out the documentation, http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html, you can see that a function called "getName()" can be called on an instance of Method and it returns a string with the name of the method. That's what we want.