Running JShell with -source 8 (-C-source -C8), only the first snippet is evaluated:
---
$ jshell -C-source -C8
| Welcome to JShell -- Version 17-internal
| For an introduction type: /help intro
jshell> 1+1
$1 ==> 2
jshell> 1+2
| Error:
| cannot find symbol
| symbol: class
| 1+2
| ^
| Error:
| static import only from classes and interfaces
| 1+2
| ^
---
---
$ jshell -C-source -C8
| Welcome to JShell -- Version 17-internal
| For an introduction type: /help intro
jshell> 1+1
$1 ==> 2
jshell> 1+2
| Error:
| cannot find symbol
| symbol: class
| 1+2
| ^
| Error:
| static import only from classes and interfaces
| 1+2
| ^
---