Java Reflection - Attributes

Sort by

recency

|

107 Discussions

|

  • + 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

  • + 0 comments

    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);
        }
        }
    
    }
    
  • + 1 comment

    Yes, we got a different Student class then the test is executed against... it is impossible to solve this way in java 8 :)

  • + 0 comments
    • 1 for this test .