Java Class getMethods() MethodThe getMethods() method of java Class class returns an array containing the method objects which represent all the public methods of the class or interface represented by a Class object, including those declared by the class or interface and inherited from superclasses and super interfaces. SyntaxParameterNA ReturnsThe array of Method objects ThrowsDoes not throw an exception Example 1Test it NowOutput: Methods = public void java.awt.Label.addNotify() public javax.accessibility.AccessibleContext java.awt.Label.getAccessibleContext() public int java.awt.Label.getAlignment() public java.lang.String java.awt.Label.getText() public synchronized void java.awt.Label.setAlignment(int) public void java.awt.Label.setText(java.lang.String) public void java.awt.Component.add(java.awt.PopupMenu) public void java.awt.Component.remove(java.awt.MenuComponent) public java.lang.String java.awt.Component.toString() public void java.awt.Component.update(java.awt.Graphics) public java.lang.String java.awt.Component.getName() public boolean java.awt.Component.contains(int,int) public boolean java.awt.Component.contains(java.awt.Point) public java.awt.Dimension java.awt.Component.size() public java.awt.Point java.awt.Component.getLocation(java.awt.Point) public java.awt.Point java.awt.Component.getLocation() public java.awt.Container java.awt.Component.getParent() Example 2Test it NowOutput: public static void ClassgetMethodsExample2.main(java.lang.String[]) public int ClassgetMethodsExample2.Calc(int) public void ClassgetMethodsExample2.Work() public static void ClassgetMethodsExample2.StaticMethod(java.lang.String) public final void java.lang.Object.wait() throws java.lang.InterruptedException public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException public boolean java.lang.Object.equals(java.lang.Object) public java.lang.String java.lang.Object.toString() public native int java.lang.Object.hashCode() public final native java.lang.Class java.lang.Object.getClass() Next TopicJava Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India