Java Reflection - Attributes

Sort by

recency

|

110 Discussions

|

  • + 0 comments

    The below code passed the test when run in Java 7 but not in Java 15 environment. Why? I cannot understand the reason? Is this just a bug?

    public class Solution { public static void main(String[] args) { Class student = Student.class;

        Method[] methods = student.getDeclaredMethods(); 
    
        ArrayList<String> methodList = new ArrayList<>();
        for (Method method : methods) {
            methodList.add(method.getName()); 
        }
    
        Collections.sort(methodList); 
        for (String name : methodList) {
            System.out.println(name); 
        }
    }
    

    }

  • + 0 comments

    Keeps happening, arrived to the correct answer in java8 but since it kept saying wrong answer, i had to look for this to find out only java 7 works...

    Please add fixing this to the to do list

  • + 0 comments

    Beware, only Java 7 works for this

  • + 0 comments

    i am using java 15 and it keeps saying cannot find symbol for Student

  • + 0 comments

    in Java 8 not work... look the output... its a shame a plataform like that keep this error so long