Selecting an Overloaded Method

   

This example uses Statement Completion to help you select an overloaded constructor method for the String class.

Note   If you have completed the steps of Creating Statements with Word Completion continue working through the following procedure. If not, take a few minutes and complete the procedure before selecting an overloaded constructor method for the String object.

Before proceeding, make sure you have loaded a .java file into the Text editor that contains the following code:

String myStr = new String

To select an overloaded method for a class

  1. With the insertion point immediately after the last "String" in the statement, type an opening parenthesis, "(".

    A pop-up window appears displaying the signature of one of the constructor methods for the String class. The spin control on the left side of this window indicates how many overloaded constructor methods (11) are available for the String class and which one is being displayed (1).

    Note   For methods and constructors that are not overloaded, this list box is replaced by the Parameter Info text box. See Building an Argument List with Parameter Info for an example that uses the Parameter Info feature.

  2. Click anywhere on the spin control to display the signatures of the other String constructor methods until you find one that takes a String argument.

    In this example, constructor number 11 of 11 meets this criteria.

  3. After the opening parenthesis, type "Hello World!");.

    Your completed statement should look like this:

    String myStr = new String("Hello World!");
    

Statement Completion also displays a class's public methods and fields. To display a member list for the String object, see Selecting Methods from a Member List.