Java Reflection - Attributes

Sort by

recency

|

106 Discussions

|

  • + 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 .
  • + 0 comments

    Agreed, worked only in Java7. The test that fails otherwise seems off to me --

    ahqym
    amftc
    anotherfunction
    atcks
    bwkbd
    cfwyc
    cmkxa
    dnpym
    dnqvo
    dvvwq
    ehjdm
    elyed
    fmyce
    getEmail
    getId
    getName
    ghtlj
    hluvb
    isqdf
    iwhtf
    jmopy
    jnskt
    kbjlt
    kgwku
    khuag
    levtp
    mcgme
    migyc
    moebl
    nixhb
    odyqp
    ogvdl
    ormim
    piwro
    plaob
    pnruo
    pqfct
    ptrup
    pvgyp
    qthde
    rmjig
    setEmail
    setId
    setName
    sumvl
    tkbpp
    tntpj
    toxdp
    twyfa
    uccfq
    ujxei
    vhxoi
    viwuu
    viyog
    whjtj
    ytijy