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.
I came to the solution by adding the following lines to use Java reflection and access the private powerof2 method in Solution.Inner.Private:
Solution.Innerinner=newSolution.Inner();Solution.Inner.PrivateinnerPrivate=inner.newPrivate();o=innerPrivate;Methodmethod=innerPrivate.getClass().getDeclaredMethod("powerof2",int.class);method.setAccessible(true);Stringresult=(String)method.invoke(o,num);System.out.println(num+" is "+result);
`
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Can You Access?
You are viewing a single comment's thread. Return to all comments →
I came to the solution by adding the following lines to use Java reflection and access the private powerof2 method in Solution.Inner.Private:
`