Exercise 3: Finding Strings in Your Code

In this exercise, you will learn how to find all occurrences of a specified string constant in your source code. You will then view the matches with their surrounding source code.
  1. Check the Java WorkShop tool bar for the current portfolio and project.
    If the current portfolio is not "personal," choose Portfolio => Choose => personal. If the current project is not Blink, choose Project => Choose => Blink.

  2. In the Source Browser, click the String Search tab.

  3. Enter green in the String text field.

  4. Click the Find Matches control on the Source Browser tool bar.
    A match is any occurrence of the string in your source code. The Source Browser finds two matches of the string green. The matches are displayed in the form: filename: line_number. You will also see the source code line that contains the string.

  5. Click the first match.
    The Source Editor opens and displays the source line containing the string. The line is highlighted in blue.

  6. Click the Next Match control in the Source Editor.
    The Source Editor displays the code for the next match.

  7. Close the Source Editor.

Next lesson:

You have completed the lessons in this tutorial. The next tutorial is Tutorial Five: Debugging a Project.