There are several to evaluate a certain expression when debugging a Java application.
1. Manually inspecting an expression
When the program execution is suspended at a certain line (either due to a breakpoint or manually stepping through the debugger), you can manually evaluate an expression by selecting the expression in the code, then right-clicking and selecting Inspect as shown in the below screenshot. Alternatively, do Ctrl+Shift+I after selecting the expression.
2. Watching an expression in the Expressions view
If you want to continuously evaluate an expression, say because it is within in a loop, you can watch it in the Expressions view. This way its value will be displayed whenever the program is suspended at each iteration of the loop. To do this, select the desired expression, then right-click and select Watch. This will open the Expressions view and show the value of the expression (see below image). You can also manually write the expression in the view.
3. Using the Display view to evaluate and execute statements
The Display view allows you to write your own expressions, statements or any code in general that would be evaluated or executed in context with the suspended program code. This can be useful if you want to evaluate complex expressions without changing your original and restart the debugging.
To open the Display view, select Window > Show View > Display. Then write your expression or statements in the view, and select one of the options in the toolbar of the view, for example to execute the written statements, or display the result of evaluating them in the view as shown in the below image. The code written in the Display view can also be inspected or executed by selecting it, then right-clicking and selecting the desired action.