| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| <html lang="en"> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <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 and select <b>Step Over</b> twice to populate <code>fFull</code>. (See the <a href="qs-13.htm">Debugging your Programs</a> section for full |
| details.)<br> |
| </li> |
| <li>Open the Display view by selecting <b>Window > Show View > Display</b> |
| and type the following line in the view: |
| <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> (<img src="../images/org.eclipse.jdt.debug.ui/etool16/disp_sbook.png" alt="Display" >) from |
| the Display view toolbar.) |
| <p> <img src="images/view_display_display.png" 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/view_display_display_done.png" alt="Display view showing evaluation result: (int) 2"> |
| </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> (<img src="../images/org.eclipse.jdt.debug.ui/etool16/insp_sbook.png" alt="Inspect" >) from the Display view toolbar.) </li> |
| <li>A lightweight window opens with the value of the evaluated expression. |
| <p> <img src="images/view_display_inspect.png" alt="Pop-up containing fFull.toArray() expression"> |
| </p> |
| </li> |
| </ol> |
| <P class="nav_footer" id="nav_footer">Next Section: <A href="qs-15.htm">Evaluating snippets</A> |
| </P> |
| <p><img src="../images/ngrelc.png" alt="Related concepts" ><br> |
| <a href="../concepts/cdebugger.htm">Debugger</a></p> |
| <p><img src="../images/ngrelt.png" alt="Related tasks" ><br> |
| <a href="../tasks/task-evaluating_expressions.htm">Evaluating expressions</a><br> |
| <a href="../tasks/task-display_evaluation_result.htm">Displaying the result of evaluating an |
| expression</a><br> |
| <a href="../tasks/task-inspect_evaluation_result.htm">Inspecting the result of evaluating an |
| expression</a></p> |
| <p><img src="../images/ngrelr.png" alt="Related reference" ><br> |
| <a href="../reference/views/expressions/ref-expressions_view.htm">Expressions view</a></p> |
| |
| |
| </body> |
| </html> |
| |