vendredi 5 janvier 2018

getDeclaredMethods() in Class class

public Method[] getDeclaredMethods() throws SecurityException

has documentation as below.

/**
     *
     * Returns an array containing {@code Method} objects reflecting all the
     * declared methods of the class or interface represented by this {@code
     * Class} object, including public, protected, default (package)
     * access, and private methods, but excluding inherited methods.

<p> If this {@code Class} object represents a type that has multiple
             * declared methods with the same name and parameter types, but different
             * return types, then the returned array has a {@code Method} object for
             * each such method.
         *

how can a single class have two [declared] methods with different return types, same name and same parameter types?





Aucun commentaire:

Enregistrer un commentaire