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 think in this problem, for java8 and java15, there is some bug, If I want to get accepted result, then I need to add the all methods name of Student class manually. But how can I know about the hidden test case?
This code is working for java7, But not working for java8 or java15
publicclassJavaReflectionAttributesTwo{publicstaticvoidmain(Stringargs[]){//!Student std=new Student();//! uses class literal, not a function.Classstd=Student.class;//Student std=new Student(); //Class Student=new Student().getClass();Method[]mtd=std.getDeclaredMethods();ArrayList<String>methodNames=newArrayList<>();for(Methodit:mtd){methodNames.add(it.getName());//keep all method name into the string array }Collections.sort(methodNames);for(Stringit:methodNames){System.out.println(it);}}}
.
The same code is working for java8 or java15, If I add all the methods of Student class.
.
importjava.lang.reflect.Method;importjava.util.*;publicclassJavaReflectionAttributesTwo{publicstaticvoidmain(Stringargs[]){//!Student std=new Student();//! uses class literal, not a function.Classstd=Student.class;//Student std=new Student(); //Class Student=new Student().getClass();Method[]mtd=std.getDeclaredMethods();ArrayList<String>methodNames=newArrayList<>();for(Methodit:mtd){methodNames.add(it.getName());//keep all method name into the string array }Collections.sort(methodNames);for(Stringit:methodNames){System.out.println(it);}}}/* add manually methods of Student class for java15/ java8, not add automatically Student class, bug in hackerRank? */classStudent{publicvoidahqym(){}publicvoidamftc(){}publicvoidanotherfunction(){}publicvoidatcks(){}publicvoidbwkbd(){}publicvoidcfwyc(){}publicvoidcmkxa(){}publicvoiddnpym(){}publicvoiddnqvo(){}publicvoiddvvwq(){}publicvoidehjdm(){}publicvoidelyed(){}publicvoidfmyce(){}publicvoidgetEmail(){}publicvoidgetId(){}publicvoidgetName(){}publicvoidghtlj(){}publicvoidhluvb(){}publicvoidisqdf(){}publicvoidiwhtf(){}publicvoidjmopy(){}publicvoidjnskt(){}publicvoidkbjlt(){}publicvoidkgwku(){}publicvoidkhuag(){}publicvoidlevtp(){}publicvoidmcgme(){}publicvoidmigyc(){}publicvoidmoebl(){}publicvoidnixhb(){}publicvoidodyqp(){}publicvoidogvdl(){}publicvoidormim(){}publicvoidpiwro(){}publicvoidplaob(){}publicvoidpnruo(){}publicvoidpqfct(){}publicvoidptrup(){}publicvoidpvgyp(){}publicvoidqthde(){}publicvoidrmjig(){}publicvoidsetEmail(){}publicvoidsetId(){}publicvoidsetName(){}publicvoidsumvl(){}publicvoidtkbpp(){}publicvoidtntpj(){}publicvoidtoxdp(){}publicvoidtwyfa(){}publicvoiduccfq(){}publicvoidujxei(){}publicvoidvhxoi(){}publicvoidviwuu(){}publicvoidviyog(){}publicvoidwhjtj(){}publicvoidytijy(){}}
Is there any other way to solve this isuue?
Is my guess correct about bug issue?
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 →
I think in this problem, for java8 and java15, there is some bug, If I want to get accepted result, then I need to add the all methods name of Student class manually. But how can I know about the hidden test case?
This code is working for java7, But not working for java8 or java15
. The same code is working for java8 or java15, If I add all the methods of Student class. .
Is there any other way to solve this isuue? Is my guess correct about bug issue?