Main Content

方法通知ation

Display Method Names

Themethodsfunction returns information on methods of MATLAB®and Java®classes.

To return the names of all the methods (including inherited methods) of the class, usemethodswithout the'-full'qualifier. Names of overloaded methods are listed only once.

显示方法签名

With the'-full'qualifier,methodsreturns a listing of the method names (including inherited methods) along with attributes, argument lists, and inheritance information on each. Each overloaded method is listed separately.

For example, display a full description of all methods of thejava.awt.Dimensionobject.

methodsjava.awt.Dimension-full
Methods for class java.awt.Dimension: Dimension() Dimension(java.awt.Dimension) Dimension(int,int) java.lang.Class getClass() % Inherited from java.lang.Object int hashCode() % Inherited from java.lang.Object boolean equals(java.lang.Object) java.lang.String toString() void notify() % Inherited from java.lang.Object void notifyAll() % Inherited from java.lang.Object void wait(long) throws java.lang.InterruptedException % Inherited from java.lang.Object void wait(long,int) throws java.lang.InterruptedException % Inherited from java.lang.Object void wait() throws java.lang.InterruptedException % Inherited from java.lang.Object java.awt.Dimension getSize() void setSize(java.awt.Dimension) void setSize(int,int)

Display Syntax in Figure Window

To see methods implemented by a particular Java (or MATLAB) class, use themethodsviewfunction. Specify the class name (along with its package name, for Java classes) in the command line. If you have imported the package that defines this class, then the class name alone suffices.

This command lists information on all methods in thejava.awt.MenuItemclass:

methodsviewjava.awt.MenuItem

A new window appears, listing one row of information for each method in the class. Each row in the window displays these fields of information describing the method.

Fields Displayed inmethodsviewWindow

Field Name Description Examples

Name

Method name

addActionListener,dispatchEvent

Return Type

Type returned by the method

void,java.lang.String

Arguments

Types of arguments passed to method

boolean,java.lang.Object

Qualifiers

Method type qualifiers

abstract, synchronized

Other

Other relevant information

throwsjava.io.IOException

Inherited From

Parent of the specified class

java.awt.MenuComponent

See Also

|