We get an evaluation error trying to use unary operators on boxed type objects.
BeanShell 3.0.0-SNAPSHOT.5569
bsh % Integer i = new Integer(0);
--> $0 = 0I :Integer
bsh % ++i;
// Error: Evaluation Error: Unary operation "++" inappropriate for object : at Line: 2 : in file: <unknown file> : ;
bsh % --i;
// Error: Evaluation Error: Unary operation "--" inappropriate for object : at Line: 3 : in file: <unknown file> : ;
Which is possible in JAVA.
| Welcome to JShell -- Version 11.0.22
| For an introduction type: /help intro
jshell> Integer i = new Integer(0);
i ==> 0
jshell> --i;
$2 ==> -1
jshell> ++i;
$3 ==> 0
We get an evaluation error trying to use unary operators on boxed type objects.
Which is possible in JAVA.