JShell
Use JShell in IntelliJ IDEA to quickly evaluate Java expressions.
JShell is a java REPL tool introduced in JDK 9. You can use it to interactively evaluate Java expressions quickly, without any overhead.
Open JShell in IntelliJ IDEA either from the main menu Tools | JShell Console, or by using Search Everywhere ⇧⇧ (macOS) / Shift+Shift (Windows/Linux) and looking for JShell Console.
Type your Java code in the JShell Console tab, and press ⌘⏎ (macOS) / Ctrl+Enter (Windows/Linux) to run this code in JShell. You will see the output of your code in the Run tool window.