| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. 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/org.eclipse.jdt.debug.ui/example_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/org.eclipse.jdt.debug.ui/example_display_result.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/org.eclipse.jdt.debug.ui/example_inspect_result.png" alt="Pop-up containing fFull.toArray() expression"> |
| </p> |
| </li> |
| </ol> |
| |
| <p><img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br> |
| <a href="../concepts/concepts-10.htm">Debugger</a></p> |
| <p><img border="0" src="../images/ngrelt.png" alt="Related tasks" ><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.png" alt="Related reference" ><br> |
| <a href="../reference/ref-56.htm">Expressions view</a></p> |
| |
| |
| </body> |
| </html> |
| |