Main Content

Determine What Classes Define a Method

To display the fully qualified name of a method implemented by aloadedJava®class, call thewhich函数。找到所有的类定义的规范ified method, usewhichwith the-allqualifier.

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

whichconcat

If thejava.lang.Stringclass is loaded, MATLAB®displays:

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

If theStringclass has not been loaded, MATLAB displays:

concat not found.

Suppose that you loaded the JavaStringandjava.awt.Frameclasses. Both of these classes have anequalsmethod. 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

Thewhichfunction operates differently on Java classes than it does on MATLAB classes:

  • whichalways displays MATLAB classes, whether they are loaded

  • whichonly 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