Java Reference
In-Depth Information
result = String(new Object());
print("new Object() is converted to", result);
undefined is converted to undefined
true is converted to true
9088 is converted to 9088
0x786A is converted to 30826
900000000000000000000 is converted to 900000000000000000000
9000000000000000000000 is converted to 9e+21
new Object(1982) is converted to 1982
new Object() is converted to [object Object]
Statements
Nashorn contains most of the statements that you have in Java. Most of the statement
types work in a very similar way to Java. The following is the list of statement types in
Nashorn:
Block Statement
Variable Statement
Empty Statement
Expression Statement
if Statement
The
Iteration (or loop) Statements
continue Statement
The
break Statement
The
return Statement
The
with Statement
The
switch Statement
The
Labelled Statements
throw Statement
The
try Statement
The
The debugger Statement
As in Java, you can use a semicolon to terminate a statement. Unlike Java, however, a
statement terminator is optional. Nashorn will insert semicolons in many cases. Most of
the time, you can omit the semicolon as the statement terminator without any problem.
 
Search WWH ::




Custom Search