In IntelliJ IDEA, you can evaluate an expression by using the "Evaluate Expression" feature. This allows you to see the result of an expression without modifying your code.
To use the "Evaluate Expression" feature, follow these steps:
Place the cursor within the expression that you want to evaluate.
Press Alt + F8 (on macOS, press Option + F8).
A dialog window will appear, showing the expression that you have selected.
If you want to modify the expression, you can do so in the dialog window.
Click the Evaluate button to see the result of the expression.
The result of the expression will be displayed in the dialog window.
Note that this feature is only available when you are debugging your code.
For more information on debugging in IntelliJ IDEA, you can refer to the IntelliJ IDEA documentation.