Enable assertions in Java Shell

DodgyCodeException :
C:\Users\Malvolio>jshell
|  Welcome to JShell -- Version 9.0.1
|  For an introduction type: /help intro

jshell> assert(false)

jshell> 

How can I make the Java Shell throw an AssertionError when an assert fails?

Eugene :

Start it with the command option:

jshell -R -ea

enter image description here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=461951&siteId=1