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.
- 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.
- In the Source Browser, click the String Search tab.
- Enter green in the String text field.
- 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.
- Click the first match.
The Source Editor opens and displays the source line containing the string. The line is highlighted in blue.
- Click the Next Match control

in the Source Editor.
The Source Editor displays the code for the next match.
- Close the Source Editor.
Next lesson:
- You have completed the lessons in this tutorial. The next tutorial is Tutorial Five: Debugging a Project.