This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Determine What Classes Define a Method

To display the fully qualified name of a method implemented by a loaded Java® class, call the which function. To find all classes that define the specified method, use which with the -all qualifier.

For example, to find the package and class name for the concat method, type:

which concat

If the java.lang.String class is loaded, MATLAB® displays:

concat is a Java method  % java.lang.String method

If the String class has not been loaded, MATLAB displays:

concat not found.

Suppose that you loaded the Java String and java.awt.Frame classes. Both of these classes have an equals method. Type:

which -all equals

The MATLAB display includes entries like these:

equals is a Java method      % java.lang.String method
equals is a Java method      % java.awt.Frame.equals
equals is a Java method      % com.mathworks.jmi.MatlabPath method

The which function operates differently on Java classes than it does on MATLAB classes:

  • which always displays MATLAB classes, whether they are loaded

  • which only displays Java classes that are loaded

You can find out which Java classes are currently loaded by using the command [m,x,j]=inmem.

See Also

|

Related Topics