| Passing Strings in an Array When the method you are calling expects an argument of an array of type String, you can create such an array by packaging the strings together in a MATLAB cell array. The strings can be of varying lengths since you are storing them in different cells of the array. As part of the method call, MATLAB converts the cell array to a Java array of String objects. In the following example, the echoPrompts method of a user-written class accepts a string array argument that MATLAB converted from its original format as a cell array of strings. The parameter list in the Java method appearsasfollows: public String[] echoPrompts(String s[]) You create the input argument by storing both strings in a MATLAB cell array. MATLAB converts this structure to a Java array ofString. myaccount.echoPrompts({'Username: ','Password: '}) ans = 'Username: ' 'Password: ' Passing Java™ Objects When calling a method that has an argument belonging to a particular Java class, you must pass an object that is an instance ofthat class. In the example below, the add method belonging to the java.awt.Menu class requires, as an argument, an object ofthe java.awt.MenuItem class. The method declaration for this is: public MenuItem add(MenuItem mi) The example operates on the frame created in the previous example in "Passing Built-In Types" on page 7-55. The second, third, and fourth lines of |