File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ var Nashorn2 = Java.type('com.winterbe.java8.Nashorn2');
22var result = Nashorn2 . fun ( 'John Doe' ) ;
33print ( '\n' + result ) ;
44
5+ Nashorn2 . fun2 ( 123 ) ;
6+ Nashorn2 . fun2 ( 49.99 ) ;
7+ Nashorn2 . fun2 ( true ) ;
8+ Nashorn2 . fun2 ( "hi there" )
9+ Nashorn2 . fun2 ( String ( "bam" ) )
10+ Nashorn2 . fun2 ( new Number ( 23 ) ) ;
511Nashorn2 . fun2 ( new Date ( ) ) ;
612Nashorn2 . fun2 ( new RegExp ( ) ) ;
713Nashorn2 . fun2 ( { foo : 'bar' } ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public static void main(String[] args) throws Exception {
2121 Invocable invocable = (Invocable ) engine ;
2222 Object result = invocable .invokeFunction ("fun1" , "Peter Parker" );
2323 System .out .println (result );
24+ System .out .println (result .getClass ());
2425
2526 invocable .invokeFunction ("fun2" , new Date ());
2627 invocable .invokeFunction ("fun2" , LocalDateTime .now ());
You can’t perform that action at this time.
0 commit comments