| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <title> Evaluating expressions </title> |
| </head> |
| <body> |
| <h1> Evaluating expressions </h1> |
| <p> In this section, you will evaluate expressions in the context of your |
| running Java program. </p> |
| <ol> |
| <li> Debug <em>junit.samples.VectorTest.java</em> to the breakpoint in the |
| <code>setup()</code> method. (See the <a href="qs-13.htm">Debugging your Programs</a> section for full |
| details.)<br> |
| In the Display view in the Debug perspective, type the following line: |
| <p> <code>fFull.size()</code></p> |
| </li> |
| <li> Select the text you just typed, and from its context menu, select <strong>Display</strong>. |
| (You can also choose <strong>Display Result of Evaluating Selected Text </strong>from |
| the Display view toolbar.) |
| <p> <img src="../images/qs-74.gif" width=235 height=90 alt="Display view with fFull.size selected and showing context menu"> |
| </p> |
| </li> |
| <li> The expression is evaluated and the result is displayed in the Display |
| view. |
| <p> <img src="../images/qs-75.gif" width=270 height=93 alt="Display view showing evaluation result: (int) 0"> |
| </p> |
| </li> |
| <li> On a new line in the Display view, type the following line: |
| <p> <code>fFull.toArray()</code> </p> |
| </li> |
| <li> Select this line, and select <strong>Inspect</strong> from the context |
| menu. (You can also choose <strong>Inspect Result of Evaluating |
| Selected Text </strong>from the Display view toolbar.) </li> |
| <li> The Expressions view opens with the value of the evaluated expression. |
| <p> <img src="../images/qs-76.gif" width=391 height=183 alt="Expressions view containing fFull.toArray() expression"> |
| </p> |
| </li> |
| </ol> |
| |
| <p><img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27"><br> |
| <a href="../concepts/concepts-10.htm">Debugger</a></p> |
| <p><img border="0" src="../images/ngrelt.gif" alt="Related tasks" width="159" height="27"><br> |
| <a href="../tasks/tasks-138.htm">Evaluating expressions</a><br> |
| <a href="../tasks/tasks-151.htm">Displaying the result of evaluating an |
| expression</a><br> |
| <a href="../tasks/tasks-150.htm">Inspecting the result of evaluating an |
| expression</a><br> |
| <a href="../tasks/tasks-107.htm">Viewing compilation errors and warnings</a></p> |
| <p><img border="0" src="../images/ngrelr.gif" alt="Related reference" width="159" height="27"><br> |
| <a href="../reference/ref-56.htm">Expressions view</a></p> |
| |
| <p> <a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0" height="14" width="324"></a> |
| </p> |
| </body> |
| </html> |
| |