The java.lang.Class.getMethods() returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and those inherited from superclasses and superinterfaces.
The method returns an array of length 0 if this Class object represents a class or interface that has no public member methods, or if this Class object represents a primitive type or void.
Syntax:public Method[] getMethods() throws SecurityException
Example:import java.lang.reflect.*;
public class ClassDemo {
public static void main(String[] args) {
try {
Class cls = Class.forName("java.awt.Label");
System.out.println("Methods =");
/* returns the array of Method objects representing the public
methods of this class */
Method m[] = cls.getMethods();
for(int i = 0; i < m.length; i++) {
system.out.println(m[i]);
}
}
catch (exception e) {
system.out.println("exception: " + e);
}
}
}
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 260 / 159176764. Delta: 0.00332 с